• Home
  • Raw
  • Download

Lines Matching +full:path +full:- +full:key

4 * Use of this source code is governed by a BSD-style license that can be
41 * Gaussian color filter -- produces a Gaussian ramp based on the color's B value,
58 rec.fPipeline->append(SkRasterPipeline::gauss_a_to_rgba); in onAppendStages()
64 // x = 1 - x; in onProgram()
65 // exp(-x * x * 4) - 0.018f; in onProgram()
68 skvm::F32 x = p->splat(-2.26661229133605957031f); in onProgram()
93 half factor = 1 - inColor.a; in asFragmentProcessor()
94 factor = exp(-factor * factor * 4) - 0.018; in asFragmentProcessor()
130 sk_sp<SkVertices> makeVertices(const SkPath& path, const SkMatrix& ctm, in makeVertices()
140 return SkShadowTessellator::MakeAmbient(path, noTrans, zParams, fTransparent); in makeVertices()
181 translate->set(0, 0); in isCompatible()
186 *translate = that.fOffset - fOffset; in isCompatible()
192 sk_sp<SkVertices> makeVertices(const SkPath& path, const SkMatrix& ctm, in makeVertices()
198 translate->set(0, 0); in makeVertices()
199 return SkShadowTessellator::MakeSpot(path, ctm, zParams, fDevLightPos, fLightRadius, in makeVertices()
202 translate->set(0, 0); in makeVertices()
203 return SkShadowTessellator::MakeSpot(path, ctm, zParams, fDevLightPos, fLightRadius, in makeVertices()
206 // pick a canonical place to generate shadow, with light centered over path in makeVertices()
214 return SkShadowTessellator::MakeSpot(path, noTrans, zParams, in makeVertices()
279 sk_sp<SkVertices> add(const SkPath& path, const FACTORY& factory, const SkMatrix& matrix, in add() argument
281 … sk_sp<SkVertices> vertices = factory.makeVertices(path, matrix, translate, isLimitElevation); in add()
290 fSize -= fEntries[i].fVertices->approximateSize(); in add()
295 fSize += vertices->approximateSize(); in add()
317 * path. The key represents the path's geometry and not any shadow params.
321 CachedTessellationsRec(const SkResourceCache::Key& key, in CachedTessellationsRec() argument
324 fKey.reset(new uint8_t[key.size()]); in CachedTessellationsRec()
325 memcpy(fKey.get(), &key, key.size()); in CachedTessellationsRec()
328 const Key& getKey() const override { in getKey()
329 return *reinterpret_cast<SkResourceCache::Key*>(fKey.get()); in getKey()
332 size_t bytesUsed() const override { return fTessellations->size(); } in bytesUsed()
341 return fTessellations->find(factory, matrix, translate); in find()
373 * Function called by SkResourceCache when a matching cache key is found. The FACTORY and matrix of
381 findContext->fVertices = in FindVisitor()
382 rec.find(*findContext->fFactory, *findContext->fViewMatrix, &findContext->fTranslate); in FindVisitor()
383 if (findContext->fVertices) { in FindVisitor()
388 findContext->fTessellationsOnFailure = rec.refTessellations(); in FindVisitor()
394 ShadowedPath(const SkPath* path, const SkMatrix* viewMatrix) in ShadowedPath() argument
395 : fPath(path) in ShadowedPath()
398 , fShapeForKey(*path, GrStyle::SimpleFill()) in ShadowedPath()
402 const SkPath& path() const { return *fPath; } in path() function in __anon57a43f360111::ShadowedPath
405 /** Negative means the vertices should not be cached for this path. */
407 void writeKey(void* key) const { in writeKey()
408 fShapeForKey.writeUnstyledKey(reinterpret_cast<uint32_t*>(key)); in writeKey()
412 int keyBytes() const { return -1; } in keyBytes()
413 void writeKey(void* key) const { SK_ABORT("Should never be called"); } in writeKey()
428 // When the SkPathRef genID changes, invalidate a corresponding GrResource described by key.
431 ShadowInvalidator(const SkResourceCache::Key& key) { in ShadowInvalidator() argument
432 fKey.reset(new uint8_t[key.size()]); in ShadowInvalidator()
433 memcpy(fKey.get(), &key, key.size()); in ShadowInvalidator()
437 const SkResourceCache::Key& getKey() const { in getKey()
438 return *reinterpret_cast<SkResourceCache::Key*>(fKey.get()); in getKey()
447 SkResourceCache::Find(this->getKey(), ShadowInvalidator::FindVisitor, nullptr); in changed()
460 SkScalar tx, SkScalar ty, bool)> drawProc, ShadowedPath& path, in draw_shadow() argument
462 FindContext<FACTORY> context(&path.viewMatrix(), &factory); in draw_shadow()
464 SkResourceCache::Key* key = nullptr; in draw_shadow() local
466 int keyDataBytes = path.keyBytes(); in draw_shadow()
468 keyStorage.reset(keyDataBytes + sizeof(SkResourceCache::Key)); in draw_shadow()
469 key = new (keyStorage.begin()) SkResourceCache::Key(); in draw_shadow()
470 path.writeKey((uint32_t*)(keyStorage.begin() + sizeof(*key))); in draw_shadow()
471 key->init(&kNamespace, resource_cache_shared_id(), keyDataBytes); in draw_shadow()
472 SkResourceCache::Find(*key, FindVisitor<FACTORY>, &context); in draw_shadow()
480 // TODO: handle transforming the path as part of the tessellator in draw_shadow()
481 if (key) { in draw_shadow()
489 vertices = tessellations->add(path.path(), factory, path.viewMatrix(), in draw_shadow()
494 auto rec = new CachedTessellationsRec(*key, std::move(tessellations)); in draw_shadow()
495 SkPathPriv::AddGenIDChangeListener(path.path(), sk_make_sp<ShadowInvalidator>(*key)); in draw_shadow()
498 vertices = factory.makeVertices(path.path(), path.viewMatrix(), in draw_shadow()
510 SkColorFilters::Blend(color, SkBlendMode::kModulate)->makeComposed( in draw_shadow()
514 context.fTranslate.fX, context.fTranslate.fY, path.viewMatrix().hasPerspective()); in draw_shadow()
551 SkScalar alphaAdjust = (2.6f + (-2.66667f + 1.06667f*origA)*origA)*origA; in ComputeTonalColors()
552 SkScalar colorAlpha = (3.544762f + (-4.891428f + 2.3466f*luminance)*luminance)*luminance; in ComputeTonalColors()
559 SkScalar greyscaleAlpha = SkTPin(origA*(1 - 0.4f*luminance), 0.0f, 1.0f); in ComputeTonalColors()
566 // (C_a - S_a*C_a)*C_rgb + (1 - (S_a + C_a - S_a*C_a))*B_rgb in ComputeTonalColors()
568 // Assuming premultiplied alpha, this means we scale the color by (C_a - S_a*C_a) and in ComputeTonalColors()
569 // set the alpha to (S_a + C_a - S_a*C_a). in ComputeTonalColors()
570 SkScalar colorScale = colorAlpha*(SK_Scalar1 - greyscaleAlpha); in ComputeTonalColors()
579 static bool fill_shadow_rec(const SkPath& path, const SkPoint3& zPlaneParams, in fill_shadow_rec() argument
594 rec->fZPlaneParams = zPlaneParams; in fill_shadow_rec()
595 rec->fLightPos = { pt.fX, pt.fY, lightPos.fZ }; in fill_shadow_rec()
596 rec->fLightRadius = lightRadius; in fill_shadow_rec()
597 rec->fAmbientColor = ambientColor; in fill_shadow_rec()
598 rec->fSpotColor = spotColor; in fill_shadow_rec()
599 rec->fFlags = flags; in fill_shadow_rec()
604 // Draw an offset spot shadow and outlining ambient shadow for the given path.
605 void SkShadowUtils::DrawShadow(SkCanvas* canvas, const SkPath& path, const SkPoint3& zPlaneParams, in DrawShadow() argument
609 …DrawShadowStyle(canvas, path, zPlaneParams, lightPos, lightRadius, ambientColor, spotColor, flags,… in DrawShadow()
612 void SkShadowUtils::DrawShadowStyle(SkCanvas* canvas, const SkPath& path, const SkPoint3& zPlanePar… in DrawShadowStyle() argument
618 if (!fill_shadow_rec(path, zPlaneParams, lightPos, lightRadius, ambientColor, spotColor, in DrawShadowStyle()
619 flags, canvas->getTotalMatrix(), &rec)) { in DrawShadowStyle()
623 canvas->private_draw_shadow_rec(path, rec); in DrawShadowStyle()
626 bool SkShadowUtils::GetLocalBounds(const SkMatrix& ctm, const SkPath& path, in GetLocalBounds() argument
630 if (!fill_shadow_rec(path, zPlaneParams, lightPos, lightRadius, SK_ColorBLACK, SK_ColorBLACK, in GetLocalBounds()
635 SkDrawShadowMetrics::GetLocalBounds(path, rec, ctm, bounds); in GetLocalBounds()
647 void SkBaseDevice::drawShadow(const SkPath& path, const SkDrawShadowRec& rec) { in drawShadow() argument
650 if (vertices->priv().vertexCount()) { in drawShadow()
657 : this->localToDevice() * SkMatrix::Translate(tx, ty)); in drawShadow()
658 this->drawVertices(vertices, mode, paint); in drawShadow()
666 SkMatrix viewMatrix = this->localToDevice(); in drawShadow()
669 ShadowedPath shadowedPath(&path, &viewMatrix); in drawShadow()
674 bool uncached = tiltZPlane || path.isVolatile(); in drawShadow()
686 sk_sp<SkVertices> vertices = SkShadowTessellator::MakeAmbient(path, viewMatrix, in drawShadow()
695 SkBlendMode::kModulate)->makeComposed( in drawShadow()
697 this->drawVertices(vertices.get(), SkBlendMode::kModulate, paint); in drawShadow()
714 // Pretransform the path to avoid transforming the stroke, below. in drawShadow()
716 path.transform(viewMatrix, &devSpacePath); in drawShadow()
720 // the tesselation, and sets the alpha on the path to 1/AmbientRecipAlpha (or 'a'). in drawShadow()
726 // | |<---------- r ------>| in drawShadow()
727 // |<------|--- f -------------->| in drawShadow()
733 // We now need to outset the path to place the new edge in the center of the in drawShadow()
737 // | |<------|--- r ------>| in drawShadow()
738 // |<------|--- f -|------------>| in drawShadow()
739 // | |<- o ->|<--- f/2 --->| in drawShadow()
741 // r = o + f/2, so o = r - f/2 in drawShadow()
748 SkScalar strokeWidth = 0.5f*(devSpaceOutset - blurRadius); in drawShadow()
758 this->drawPath(devSpacePath, paint); in drawShadow()
766 sk_sp<SkVertices> vertices = SkShadowTessellator::MakeSpot(path, viewMatrix, in drawShadow()
777 SkBlendMode::kModulate)->makeComposed( in drawShadow()
779 this->drawVertices(vertices.get(), SkBlendMode::kModulate, paint); in drawShadow()
790 SkPoint center = SkPoint::Make(path.getBounds().centerX(), path.getBounds().centerY()); in drawShadow()
800 SkDrawShadowMetrics::GetSpotParams(zPlaneParams.fZ, devLightPos.fX - center.fX, in drawShadow()
801 devLightPos.fY - center.fY, devLightPos.fZ, in drawShadow()
807 viewMatrix.mapRect(&devBounds, path.getBounds()); in drawShadow()
819 } else if (path.isConvex()) { in drawShadow()
850 path.getBounds(), directional, in drawShadow()
861 this->drawPath(path, paint); in drawShadow()