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

Unified Diff: src/gpu/GrSoftwarePathRenderer.cpp

Issue 1993403002: GrSWMaskHelper and GrSoftwarePathRenderer only need the textureProvider (not GrContext) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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/GrSoftwarePathRenderer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrSoftwarePathRenderer.cpp
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index d964e1f42f65c0c5e1851d7ec87cf0ae69a7ba1e..aefaf27308e0b51d25501c66d1073512c6d503dc 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -6,13 +6,13 @@
*/
#include "GrSoftwarePathRenderer.h"
-#include "GrContext.h"
#include "GrSWMaskHelper.h"
+#include "GrTextureProvider.h"
#include "batches/GrRectBatchFactory.h"
////////////////////////////////////////////////////////////////////////////////
bool GrSoftwarePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
- return SkToBool(fContext);
+ return SkToBool(fTexProvider);
}
namespace {
@@ -21,22 +21,17 @@ namespace {
// gets device coord bounds of path (not considering the fill) and clip. The
// path bounds will be a subset of the clip bounds. returns false if
// path bounds would be empty.
-bool get_path_and_clip_bounds(const GrPipelineBuilder* pipelineBuilder,
+bool get_path_and_clip_bounds(int width, int height,
const GrClip& clip,
const SkPath& path,
const SkMatrix& matrix,
SkIRect* devPathBounds,
SkIRect* devClipBounds) {
// compute bounds as intersection of rt size, clip, and path
- const GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
- if (nullptr == rt) {
- return false;
- }
-
- clip.getConservativeBounds(rt->width(), rt->height(), devClipBounds);
+ clip.getConservativeBounds(width, height, devClipBounds);
if (devClipBounds->isEmpty()) {
- *devPathBounds = SkIRect::MakeWH(rt->width(), rt->height());
+ *devPathBounds = SkIRect::MakeWH(width, height);
return false;
}
@@ -112,12 +107,15 @@ void draw_around_inv_path(GrDrawTarget* target,
// return true on success; false on failure
bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
GR_AUDIT_TRAIL_AUTO_FRAME(args.fTarget->getAuditTrail(), "GrSoftwarePathRenderer::onDrawPath");
- if (nullptr == fContext) {
+ if (!fTexProvider || !args.fPipelineBuilder->getRenderTarget()) {
return false;
}
+ const int width = args.fPipelineBuilder->getRenderTarget()->width();
+ const int height = args.fPipelineBuilder->getRenderTarget()->height();
+
SkIRect devPathBounds, devClipBounds;
- if (!get_path_and_clip_bounds(args.fPipelineBuilder, *args.fClip, *args.fPath,
+ if (!get_path_and_clip_bounds(width, height, *args.fClip, *args.fPath,
*args.fViewMatrix, &devPathBounds, &devClipBounds)) {
if (args.fPath->isInverseFillType()) {
draw_around_inv_path(args.fTarget, args.fPipelineBuilder, *args.fClip, args.fColor,
@@ -127,7 +125,7 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
}
SkAutoTUnref<GrTexture> texture(
- GrSWMaskHelper::DrawPathMaskToTexture(fContext, *args.fPath, *args.fStyle,
+ GrSWMaskHelper::DrawPathMaskToTexture(fTexProvider, *args.fPath, *args.fStyle,
devPathBounds,
args.fAntiAlias, args.fViewMatrix));
if (nullptr == texture) {
« no previous file with comments | « src/gpu/GrSoftwarePathRenderer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698