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

Side by Side Diff: src/gpu/GrLayerHoister.cpp

Issue 809823003: Give the hoisting surfaces surface props (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrLayerCache.h" 8 #include "GrLayerCache.h"
9 #include "GrLayerHoister.h" 9 #include "GrLayerHoister.h"
10 #include "GrRecordReplaceDraw.h" 10 #include "GrRecordReplaceDraw.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 prepare_for_hoisting(layerCache, topLevelPicture, initialMat, info, srcI R, dstIR, 227 prepare_for_hoisting(layerCache, topLevelPicture, initialMat, info, srcI R, dstIR,
228 needRendering, recycled, false, numSamples); 228 needRendering, recycled, false, numSamples);
229 } 229 }
230 } 230 }
231 231
232 void GrLayerHoister::DrawLayersToAtlas(GrContext* context, 232 void GrLayerHoister::DrawLayersToAtlas(GrContext* context,
233 const SkTDArray<GrHoistedLayer>& atlased) { 233 const SkTDArray<GrHoistedLayer>& atlased) {
234 if (atlased.count() > 0) { 234 if (atlased.count() > 0) {
235 // All the atlased layers are rendered into the same GrTexture 235 // All the atlased layers are rendered into the same GrTexture
236 SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
236 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTargetDirect( 237 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTargetDirect(
237 atlased[0].fLayer->texture()->asRenderTa rget(), NULL)); 238 atlased[0].fLayer->texture()->asRenderTa rget(), &props));
238 239
239 SkCanvas* atlasCanvas = surface->getCanvas(); 240 SkCanvas* atlasCanvas = surface->getCanvas();
240 241
241 for (int i = 0; i < atlased.count(); ++i) { 242 for (int i = 0; i < atlased.count(); ++i) {
242 const GrCachedLayer* layer = atlased[i].fLayer; 243 const GrCachedLayer* layer = atlased[i].fLayer;
243 const SkPicture* pict = atlased[i].fPicture; 244 const SkPicture* pict = atlased[i].fPicture;
244 const SkIPoint offset = SkIPoint::Make(layer->srcIR().fLeft, layer-> srcIR().fTop); 245 const SkIPoint offset = SkIPoint::Make(layer->srcIR().fLeft, layer-> srcIR().fTop);
245 SkDEBUGCODE(const SkPaint* layerPaint = layer->paint();) 246 SkDEBUGCODE(const SkPaint* layerPaint = layer->paint();)
246 247
247 SkASSERT(!layerPaint || !layerPaint->getImageFilter()); 248 SkASSERT(!layerPaint || !layerPaint->getImageFilter());
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 layer->setOffset(offset); 318 layer->setOffset(offset);
318 } 319 }
319 320
320 void GrLayerHoister::DrawLayers(GrContext* context, const SkTDArray<GrHoistedLay er>& layers) { 321 void GrLayerHoister::DrawLayers(GrContext* context, const SkTDArray<GrHoistedLay er>& layers) {
321 for (int i = 0; i < layers.count(); ++i) { 322 for (int i = 0; i < layers.count(); ++i) {
322 GrCachedLayer* layer = layers[i].fLayer; 323 GrCachedLayer* layer = layers[i].fLayer;
323 const SkPicture* pict = layers[i].fPicture; 324 const SkPicture* pict = layers[i].fPicture;
324 const SkIPoint offset = SkIPoint::Make(layer->srcIR().fLeft, layer->srcI R().fTop); 325 const SkIPoint offset = SkIPoint::Make(layer->srcIR().fLeft, layer->srcI R().fTop);
325 326
326 // Each non-atlased layer has its own GrTexture 327 // Each non-atlased layer has its own GrTexture
328 SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
327 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTargetDirect( 329 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTargetDirect(
328 layer->texture()->asRenderTarget(), NULL )); 330 layer->texture()->asRenderTarget(), &pro ps));
329 331
330 SkCanvas* layerCanvas = surface->getCanvas(); 332 SkCanvas* layerCanvas = surface->getCanvas();
331 333
332 SkASSERT(0 == layer->rect().fLeft && 0 == layer->rect().fTop); 334 SkASSERT(0 == layer->rect().fLeft && 0 == layer->rect().fTop);
333 335
334 // Add a rect clip to make sure the rendering doesn't 336 // Add a rect clip to make sure the rendering doesn't
335 // extend beyond the boundaries of the layer 337 // extend beyond the boundaries of the layer
336 const SkRect bound = SkRect::Make(layer->rect()); 338 const SkRect bound = SkRect::Make(layer->rect());
337 layerCanvas->clipRect(bound); 339 layerCanvas->clipRect(bound);
338 layerCanvas->clear(SK_ColorTRANSPARENT); 340 layerCanvas->clear(SK_ColorTRANSPARENT);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 void GrLayerHoister::PurgeCache(GrContext* context) { 374 void GrLayerHoister::PurgeCache(GrContext* context) {
373 #if !GR_CACHE_HOISTED_LAYERS 375 #if !GR_CACHE_HOISTED_LAYERS
374 GrLayerCache* layerCache = context->getLayerCache(); 376 GrLayerCache* layerCache = context->getLayerCache();
375 377
376 // This code completely clears out the atlas. It is required when 378 // This code completely clears out the atlas. It is required when
377 // caching is disabled so the atlas doesn't fill up and force more 379 // caching is disabled so the atlas doesn't fill up and force more
378 // free floating layers 380 // free floating layers
379 layerCache->purgeAll(); 381 layerCache->purgeAll();
380 #endif 382 #endif
381 } 383 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698