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

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

Issue 583773004: Revert of introduce Props to surface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrDistanceFieldTextContext.cpp ('k') | src/gpu/SkGpuDevice.h » ('j') | 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 "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 136
137 void GrLayerHoister::DrawLayers(const SkPicture* picture, 137 void GrLayerHoister::DrawLayers(const SkPicture* picture,
138 const SkTDArray<GrCachedLayer*>& atlased, 138 const SkTDArray<GrCachedLayer*>& atlased,
139 const SkTDArray<GrCachedLayer*>& nonAtlased, 139 const SkTDArray<GrCachedLayer*>& nonAtlased,
140 GrReplacements* replacements) { 140 GrReplacements* replacements) {
141 // Render the atlased layers that require it 141 // Render the atlased layers that require it
142 if (atlased.count() > 0) { 142 if (atlased.count() > 0) {
143 // All the atlased layers are rendered into the same GrTexture 143 // All the atlased layers are rendered into the same GrTexture
144 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTargetDirect( 144 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTargetDirect(
145 atlased[0]->texture()->asRenderTarget(), NULL)); 145 atlased[0]->texture()->asRenderT arget(),
146 SkSurface::kStandard_TextRenderM ode));
146 147
147 SkCanvas* atlasCanvas = surface->getCanvas(); 148 SkCanvas* atlasCanvas = surface->getCanvas();
148 149
149 SkPaint paint; 150 SkPaint paint;
150 paint.setColor(SK_ColorTRANSPARENT); 151 paint.setColor(SK_ColorTRANSPARENT);
151 paint.setXfermode(SkXfermode::Create(SkXfermode::kSrc_Mode))->unref(); 152 paint.setXfermode(SkXfermode::Create(SkXfermode::kSrc_Mode))->unref();
152 153
153 for (int i = 0; i < atlased.count(); ++i) { 154 for (int i = 0; i < atlased.count(); ++i) {
154 GrCachedLayer* layer = atlased[i]; 155 GrCachedLayer* layer = atlased[i];
155 156
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 189
189 atlasCanvas->flush(); 190 atlasCanvas->flush();
190 } 191 }
191 192
192 // Render the non-atlased layers that require it 193 // Render the non-atlased layers that require it
193 for (int i = 0; i < nonAtlased.count(); ++i) { 194 for (int i = 0; i < nonAtlased.count(); ++i) {
194 GrCachedLayer* layer = nonAtlased[i]; 195 GrCachedLayer* layer = nonAtlased[i];
195 196
196 // Each non-atlased layer has its own GrTexture 197 // Each non-atlased layer has its own GrTexture
197 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTargetDirect( 198 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTargetDirect(
198 layer->texture()->asRenderTarget(), NULL )); 199 layer->texture()->asRenderTarget (),
200 SkSurface::kStandard_TextRenderM ode));
199 201
200 SkCanvas* layerCanvas = surface->getCanvas(); 202 SkCanvas* layerCanvas = surface->getCanvas();
201 203
202 // Add a rect clip to make sure the rendering doesn't 204 // Add a rect clip to make sure the rendering doesn't
203 // extend beyond the boundaries of the atlased sub-rect 205 // extend beyond the boundaries of the atlased sub-rect
204 SkRect bound = SkRect::MakeXYWH(SkIntToScalar(layer->rect().fLeft), 206 SkRect bound = SkRect::MakeXYWH(SkIntToScalar(layer->rect().fLeft),
205 SkIntToScalar(layer->rect().fTop), 207 SkIntToScalar(layer->rect().fTop),
206 SkIntToScalar(layer->rect().width()), 208 SkIntToScalar(layer->rect().width()),
207 SkIntToScalar(layer->rect().height())); 209 SkIntToScalar(layer->rect().height()));
208 210
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 #if DISABLE_CACHING 254 #if DISABLE_CACHING
253 // This code completely clears out the atlas. It is required when 255 // This code completely clears out the atlas. It is required when
254 // caching is disabled so the atlas doesn't fill up and force more 256 // caching is disabled so the atlas doesn't fill up and force more
255 // free floating layers 257 // free floating layers
256 layerCache->purge(picture->uniqueID()); 258 layerCache->purge(picture->uniqueID());
257 259
258 layerCache->purgeAll(); 260 layerCache->purgeAll();
259 #endif 261 #endif
260 } 262 }
261 263
OLDNEW
« no previous file with comments | « src/gpu/GrDistanceFieldTextContext.cpp ('k') | src/gpu/SkGpuDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698