| OLD | NEW |
| 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 void* pixels = sk_malloc_throw(size); | 305 void* pixels = sk_malloc_throw(size); |
| 306 // if rowBytes isn't tight then set the padding to a known value | 306 // if rowBytes isn't tight then set the padding to a known value |
| 307 if (!c.fTightRowBytes) { | 307 if (!c.fTightRowBytes) { |
| 308 memset(pixels, DEV_PAD, size); | 308 memset(pixels, DEV_PAD, size); |
| 309 } | 309 } |
| 310 return SkSurface::NewRasterDirectReleaseProc(info, pixels, rowBytes,
free_pixels, NULL); | 310 return SkSurface::NewRasterDirectReleaseProc(info, pixels, rowBytes,
free_pixels, NULL); |
| 311 } | 311 } |
| 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 GrSurfaceDesc desc; |
| 316 desc.fFlags = kRenderTarget_GrTextureFlagBit; | 316 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 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 SkAutoTUnref<GrTexture> texture( | 322 SkAutoTUnref<GrTexture> texture( |
| 323 grCtx->refScratchTexture(desc, GrContext::kExact_ScratchTexMatch
)); | 323 grCtx->refScratchTexture(desc, GrContext::kExact_ScratchTexMatch
)); |
| 324 return SkSurface::NewRenderTargetDirect(texture->asRenderTarget()); | 324 return SkSurface::NewRenderTargetDirect(texture->asRenderTarget()); |
| 325 #endif | 325 #endif |
| 326 } | 326 } |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |