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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 1956473002: Retract GrRenderTarget a bit within SkGpuDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove possible regressor 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 | « include/gpu/GrDrawContext.h ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index a5af472cbb702c0179543b48193d390d55c6e5b2..5206c63ae01d5de04e49fafcf1bebf199ff30719 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -740,13 +740,13 @@ static int determine_tile_size(const SkIRect& src, int maxTileSize) {
// Given a bitmap, an optional src rect, and a context with a clip and matrix determine what
// pixels from the bitmap are necessary.
-static void determine_clipped_src_rect(const GrRenderTarget* rt,
+static void determine_clipped_src_rect(int width, int height,
const GrClip& clip,
const SkMatrix& viewMatrix,
const SkISize& imageSize,
const SkRect* srcRectPtr,
SkIRect* clippedSrcIRect) {
- clip.getConservativeBounds(rt->width(), rt->height(), clippedSrcIRect, nullptr);
+ clip.getConservativeBounds(width, height, clippedSrcIRect, nullptr);
SkMatrix inv;
if (!viewMatrix.invert(&inv)) {
clippedSrcIRect->setEmpty();
@@ -779,7 +779,8 @@ bool SkGpuDevice::shouldTileImageID(uint32_t imageID, const SkIRect& imageRect,
ASSERT_SINGLE_OWNER
// if it's larger than the max tile size, then we have no choice but tiling.
if (imageRect.width() > maxTileSize || imageRect.height() > maxTileSize) {
- determine_clipped_src_rect(fRenderTarget, fClip, viewMatrix, imageRect.size(),
+ determine_clipped_src_rect(fDrawContext->width(), fDrawContext->height(),
+ fClip, viewMatrix, imageRect.size(),
srcRectPtr, clippedSubset);
*tileSize = determine_tile_size(*clippedSubset, maxTileSize);
return true;
@@ -807,7 +808,8 @@ bool SkGpuDevice::shouldTileImageID(uint32_t imageID, const SkIRect& imageRect,
// Figure out how much of the src we will need based on the src rect and clipping. Reject if
// tiling memory savings would be < 50%.
- determine_clipped_src_rect(fRenderTarget, fClip, viewMatrix, imageRect.size(), srcRectPtr,
+ determine_clipped_src_rect(fDrawContext->width(), fDrawContext->height(),
+ fClip, viewMatrix, imageRect.size(), srcRectPtr,
clippedSubset);
*tileSize = kBmpSmallTileSize; // already know whole bitmap fits in one max sized tile.
size_t usedTileBytes = get_tile_count(*clippedSubset, kBmpSmallTileSize) *
@@ -1769,7 +1771,7 @@ sk_sp<SkSurface> SkGpuDevice::makeSurface(const SkImageInfo& info, const SkSurfa
ASSERT_SINGLE_OWNER
// TODO: Change the signature of newSurface to take a budgeted parameter.
static const SkBudgeted kBudgeted = SkBudgeted::kNo;
- return SkSurface::MakeRenderTarget(fContext, kBudgeted, info, fRenderTarget->desc().fSampleCnt,
+ return SkSurface::MakeRenderTarget(fContext, kBudgeted, info, fDrawContext->desc().fSampleCnt,
&props);
}
@@ -1814,7 +1816,7 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture
initialMatrix,
clipBounds,
&atlasedNeedRendering, &atlasedRecycled,
- fRenderTarget->numColorSamples());
+ fDrawContext->numColorSamples());
GrLayerHoister::DrawLayersToAtlas(fContext, atlasedNeedRendering);
@@ -1826,7 +1828,7 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture
initialMatrix,
clipBounds,
&needRendering, &recycled,
- fRenderTarget->numColorSamples());
+ fDrawContext->numColorSamples());
GrLayerHoister::DrawLayers(fContext, needRendering);
« no previous file with comments | « include/gpu/GrDrawContext.h ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698