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

Side by Side Diff: tests/WritePixelsTest.cpp

Issue 638403003: Remove uses of GrAutoScratchTexture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 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 | « tests/ReadPixelsTest.cpp ('k') | 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 2011 Google Inc. 2 * Copyright 2011 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 "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 #if SK_SUPPORT_GPU 312 #if SK_SUPPORT_GPU
313 case kGpu_BottomLeft_DevType: 313 case kGpu_BottomLeft_DevType:
314 case kGpu_TopLeft_DevType: 314 case kGpu_TopLeft_DevType:
315 GrTextureDesc desc; 315 GrTextureDesc desc;
316 desc.fFlags = kRenderTarget_GrTextureFlagBit; 316 desc.fFlags = kRenderTarget_GrTextureFlagBit;
317 desc.fWidth = DEV_W; 317 desc.fWidth = DEV_W;
318 desc.fHeight = DEV_H; 318 desc.fHeight = DEV_H;
319 desc.fConfig = kSkia8888_GrPixelConfig; 319 desc.fConfig = kSkia8888_GrPixelConfig;
320 desc.fOrigin = kGpu_TopLeft_DevType == c.fDevType ? 320 desc.fOrigin = kGpu_TopLeft_DevType == c.fDevType ?
321 kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin; 321 kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin;
322 GrAutoScratchTexture ast(grCtx, desc, GrContext::kExact_ScratchTexMa tch); 322 SkAutoTUnref<GrTexture> texture(
323 SkAutoTUnref<GrTexture> tex(ast.detach()); 323 grCtx->refScratchTexture(desc, GrContext::kExact_ScratchTexMatch ));
324 return SkSurface::NewRenderTargetDirect(tex->asRenderTarget()); 324 return SkSurface::NewRenderTargetDirect(texture->asRenderTarget());
325 #endif 325 #endif
326 } 326 }
327 return NULL; 327 return NULL;
328 } 328 }
329 329
330 static bool setup_bitmap(SkBitmap* bm, SkColorType ct, SkAlphaType at, int w, in t h, int tightRB) { 330 static bool setup_bitmap(SkBitmap* bm, SkColorType ct, SkAlphaType at, int w, in t h, int tightRB) {
331 size_t rowBytes = tightRB ? 0 : 4 * w + 60; 331 size_t rowBytes = tightRB ? 0 : 4 * w + 60;
332 SkImageInfo info = SkImageInfo::Make(w, h, ct, at); 332 SkImageInfo info = SkImageInfo::Make(w, h, ct, at);
333 if (!allocRowBytes(bm, info, rowBytes)) { 333 if (!allocRowBytes(bm, info, rowBytes)) {
334 return false; 334 return false;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 SkIRect writeRect = SkIRect::MakeXYWH(rect.fLeft, rect.f Top, 471 SkIRect writeRect = SkIRect::MakeXYWH(rect.fLeft, rect.f Top,
472 bmp.width(), bmp.h eight()); 472 bmp.width(), bmp.h eight());
473 bool intersects = SkIRect::Intersects(canvasRect, writeR ect) ; 473 bool intersects = SkIRect::Intersects(canvasRect, writeR ect) ;
474 REPORTER_ASSERT(reporter, intersects == (idBefore != idA fter)); 474 REPORTER_ASSERT(reporter, intersects == (idBefore != idA fter));
475 } 475 }
476 } 476 }
477 } 477 }
478 } 478 }
479 } 479 }
480 } 480 }
OLDNEW
« no previous file with comments | « tests/ReadPixelsTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698