Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: src/gpu/GrSWMaskHelper.cpp

Issue 2335343008: Add optional sw generated path coverage mask caching (Closed)
Patch Set: Add .fs to literals in new gm Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrSWMaskHelper.h ('k') | src/gpu/GrSoftwarePathRenderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrSWMaskHelper.cpp
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index 66d60ab956f0e9902ee52f5aff43a3d4cf61a41b..a20eacb75ce326395d9ba2976e05684b102e03e2 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -99,13 +99,17 @@ bool GrSWMaskHelper::init(const SkIRect& resultBounds, const SkMatrix* matrix) {
/**
* Get a texture (from the texture cache) of the correct size & format.
*/
-GrTexture* GrSWMaskHelper::createTexture() {
+GrTexture* GrSWMaskHelper::createTexture(TextureType textureType) {
GrSurfaceDesc desc;
desc.fWidth = fPixels.width();
desc.fHeight = fPixels.height();
desc.fConfig = kAlpha_8_GrPixelConfig;
- return fTexProvider->createApproxTexture(desc);
+ if (TextureType::kApproximateFit == textureType) {
+ return fTexProvider->createApproxTexture(desc);
+ } else {
+ return fTexProvider->createTexture(desc, SkBudgeted::kYes);
+ }
}
/**
@@ -138,6 +142,7 @@ GrTexture* GrSWMaskHelper::DrawShapeMaskToTexture(GrTextureProvider* texProvider
const GrShape& shape,
const SkIRect& resultBounds,
bool antiAlias,
+ TextureType textureType,
const SkMatrix* matrix) {
GrSWMaskHelper helper(texProvider);
@@ -147,7 +152,7 @@ GrTexture* GrSWMaskHelper::DrawShapeMaskToTexture(GrTextureProvider* texProvider
helper.drawShape(shape, SkRegion::kReplace_Op, antiAlias, 0xFF);
- GrTexture* texture(helper.createTexture());
+ GrTexture* texture(helper.createTexture(textureType));
if (!texture) {
return nullptr;
}
@@ -163,23 +168,22 @@ void GrSWMaskHelper::DrawToTargetWithShapeMask(GrTexture* texture,
const GrUserStencilSettings& userStencilSettings,
const GrClip& clip,
const SkMatrix& viewMatrix,
- const SkIRect& rect) {
+ const SkIPoint& textureOriginInDeviceSpace,
+ const SkIRect& deviceSpaceRectToDraw) {
SkMatrix invert;
if (!viewMatrix.invert(&invert)) {
return;
}
- SkRect dstRect = SkRect::MakeLTRB(SK_Scalar1 * rect.fLeft,
- SK_Scalar1 * rect.fTop,
- SK_Scalar1 * rect.fRight,
- SK_Scalar1 * rect.fBottom);
+ SkRect dstRect = SkRect::Make(deviceSpaceRectToDraw);
// We use device coords to compute the texture coordinates. We take the device coords and apply
// a translation so that the top-left of the device bounds maps to 0,0, and then a scaling
// matrix to normalized coords.
SkMatrix maskMatrix;
maskMatrix.setIDiv(texture->width(), texture->height());
- maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop));
+ maskMatrix.preTranslate(SkIntToScalar(-textureOriginInDeviceSpace.fX),
+ SkIntToScalar(-textureOriginInDeviceSpace.fY));
GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint));
pipelineBuilder.setUserStencil(&userStencilSettings);
« no previous file with comments | « src/gpu/GrSWMaskHelper.h ('k') | src/gpu/GrSoftwarePathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698