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

Side by Side Diff: src/gpu/effects/GrConfigConversionEffect.cpp

Issue 1404823005: GrDrawContext now holds GrRenderTarget pointer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix overlength line Created 5 years, 2 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/SkGr.cpp ('k') | src/image/SkImage_Gpu.cpp » ('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 2012 Google Inc. 2 * Copyright 2012 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 "GrConfigConversionEffect.h" 8 #include "GrConfigConversionEffect.h"
9 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "GrDrawContext.h" 10 #include "GrDrawContext.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 SkAutoTUnref<GrFragmentProcessor> pmToUPM1(new GrConfigConversionEffect( 217 SkAutoTUnref<GrFragmentProcessor> pmToUPM1(new GrConfigConversionEffect(
218 dataTex, false, *pmToUPMRule, SkMatrix::I())); 218 dataTex, false, *pmToUPMRule, SkMatrix::I()));
219 SkAutoTUnref<GrFragmentProcessor> upmToPM(new GrConfigConversionEffect( 219 SkAutoTUnref<GrFragmentProcessor> upmToPM(new GrConfigConversionEffect(
220 readTex, false, *upmToPMRule, SkMatrix::I())); 220 readTex, false, *upmToPMRule, SkMatrix::I()));
221 SkAutoTUnref<GrFragmentProcessor> pmToUPM2(new GrConfigConversionEffect( 221 SkAutoTUnref<GrFragmentProcessor> pmToUPM2(new GrConfigConversionEffect(
222 tempTex, false, *pmToUPMRule, SkMatrix::I())); 222 tempTex, false, *pmToUPMRule, SkMatrix::I()));
223 223
224 paint1.addColorFragmentProcessor(pmToUPM1); 224 paint1.addColorFragmentProcessor(pmToUPM1);
225 225
226 226
227 SkAutoTUnref<GrDrawContext> readDrawContext(context->drawContext()); 227 SkAutoTUnref<GrDrawContext> readDrawContext(context->drawContext(readTex ->asRenderTarget()));
228 if (!readDrawContext) { 228 if (!readDrawContext) {
229 failed = true; 229 failed = true;
230 break; 230 break;
231 } 231 }
232 232
233 readDrawContext->drawNonAARectToRect(readTex->asRenderTarget(), 233 readDrawContext->drawNonAARectToRect(GrClip::WideOpen(),
234 GrClip::WideOpen(),
235 paint1, 234 paint1,
236 SkMatrix::I(), 235 SkMatrix::I(),
237 kDstRect, 236 kDstRect,
238 kSrcRect); 237 kSrcRect);
239 238
240 readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, firstRead) ; 239 readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, firstRead) ;
241 240
242 paint2.addColorFragmentProcessor(upmToPM); 241 paint2.addColorFragmentProcessor(upmToPM);
243 242
244 SkAutoTUnref<GrDrawContext> tempDrawContext(context->drawContext()); 243 SkAutoTUnref<GrDrawContext> tempDrawContext(context->drawContext(tempTex ->asRenderTarget()));
245 if (!tempDrawContext) { 244 if (!tempDrawContext) {
246 failed = true; 245 failed = true;
247 break; 246 break;
248 } 247 }
249 tempDrawContext->drawNonAARectToRect(tempTex->asRenderTarget(), 248 tempDrawContext->drawNonAARectToRect(GrClip::WideOpen(),
250 GrClip::WideOpen(),
251 paint2, 249 paint2,
252 SkMatrix::I(), 250 SkMatrix::I(),
253 kDstRect, 251 kDstRect,
254 kSrcRect); 252 kSrcRect);
255 253
256 paint3.addColorFragmentProcessor(pmToUPM2); 254 paint3.addColorFragmentProcessor(pmToUPM2);
257 255
258 readDrawContext.reset(context->drawContext()); 256 readDrawContext.reset(context->drawContext(readTex->asRenderTarget()));
259 if (!readDrawContext) { 257 if (!readDrawContext) {
260 failed = true; 258 failed = true;
261 break; 259 break;
262 } 260 }
263 261
264 readDrawContext->drawNonAARectToRect(readTex->asRenderTarget(), 262 readDrawContext->drawNonAARectToRect(GrClip::WideOpen(),
265 GrClip::WideOpen(),
266 paint3, 263 paint3,
267 SkMatrix::I(), 264 SkMatrix::I(),
268 kDstRect, 265 kDstRect,
269 kSrcRect); 266 kSrcRect);
270 267
271 readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, secondRead ); 268 readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, secondRead );
272 269
273 failed = false; 270 failed = false;
274 for (int y = 0; y < 256 && !failed; ++y) { 271 for (int y = 0; y < 256 && !failed; ++y) {
275 for (int x = 0; x <= y; ++x) { 272 for (int x = 0; x <= y; ++x) {
(...skipping 22 matching lines...) Expand all
298 } else { 295 } else {
299 if (kRGBA_8888_GrPixelConfig != texture->config() && 296 if (kRGBA_8888_GrPixelConfig != texture->config() &&
300 kBGRA_8888_GrPixelConfig != texture->config() && 297 kBGRA_8888_GrPixelConfig != texture->config() &&
301 kNone_PMConversion != pmConversion) { 298 kNone_PMConversion != pmConversion) {
302 // The PM conversions assume colors are 0..255 299 // The PM conversions assume colors are 0..255
303 return nullptr; 300 return nullptr;
304 } 301 }
305 return new GrConfigConversionEffect(texture, swapRedAndBlue, pmConversio n, matrix); 302 return new GrConfigConversionEffect(texture, swapRedAndBlue, pmConversio n, matrix);
306 } 303 }
307 } 304 }
OLDNEW
« no previous file with comments | « src/gpu/SkGr.cpp ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698