| OLD | NEW |
| 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 "SkSurface_Gpu.h" | 8 #include "SkSurface_Gpu.h" |
| 9 | 9 |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 GrBackendObject SkSurface_Gpu::onGetTextureHandle(TextureHandleAccess access) { | 29 GrBackendObject SkSurface_Gpu::onGetTextureHandle(TextureHandleAccess access) { |
| 30 GrRenderTarget* rt = fDevice->accessRenderTarget(); | 30 GrRenderTarget* rt = fDevice->accessRenderTarget(); |
| 31 switch (access) { | 31 switch (access) { |
| 32 case kFlushRead_TextureHandleAccess: | 32 case kFlushRead_TextureHandleAccess: |
| 33 break; | 33 break; |
| 34 case kFlushWrite_TextureHandleAccess: | 34 case kFlushWrite_TextureHandleAccess: |
| 35 case kDiscardWrite_TextureHandleAccess: | 35 case kDiscardWrite_TextureHandleAccess: |
| 36 // for now we don't special-case on Discard, but we may in the futur
e. | 36 // for now we don't special-case on Discard, but we may in the futur
e. |
| 37 this->notifyContentWillChange(kRetain_ContentChangeMode); | 37 this->notifyContentWillChange(kRetain_ContentChangeMode); |
| 38 // legacy: need to dirty the bitmap's genID in our device (curse it) |
| 39 fDevice->fLegacyBitmap.notifyPixelsChanged(); |
| 38 break; | 40 break; |
| 39 } | 41 } |
| 40 rt->prepareForExternalIO(); | 42 rt->prepareForExternalIO(); |
| 41 return rt->asTexture()->getTextureHandle(); | 43 return rt->asTexture()->getTextureHandle(); |
| 42 } | 44 } |
| 43 | 45 |
| 44 SkCanvas* SkSurface_Gpu::onNewCanvas() { | 46 SkCanvas* SkSurface_Gpu::onNewCanvas() { |
| 45 SkCanvas::InitFlags flags = SkCanvas::kDefault_InitFlags; | 47 SkCanvas::InitFlags flags = SkCanvas::kDefault_InitFlags; |
| 46 // When we think this works... | 48 // When we think this works... |
| 47 // flags |= SkCanvas::kConservativeRasterClip_InitFlag; | 49 // flags |= SkCanvas::kConservativeRasterClip_InitFlag; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 } | 151 } |
| 150 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(rt, props, | 152 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(rt, props, |
| 151 SkGpuDevice::kUninit_In
itContents)); | 153 SkGpuDevice::kUninit_In
itContents)); |
| 152 if (!device) { | 154 if (!device) { |
| 153 return NULL; | 155 return NULL; |
| 154 } | 156 } |
| 155 return SkNEW_ARGS(SkSurface_Gpu, (device)); | 157 return SkNEW_ARGS(SkSurface_Gpu, (device)); |
| 156 } | 158 } |
| 157 | 159 |
| 158 #endif | 160 #endif |
| OLD | NEW |