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

Side by Side Diff: src/image/SkSurface_Gpu.cpp

Issue 1166993002: Towards removing getTexture() from SkImage (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 6 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/image/SkImage_Gpu.cpp ('k') | src/utils/SkDeferredCanvas.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 "SkSurface_Gpu.h" 8 #include "SkSurface_Gpu.h"
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 // Create a new render target and, if necessary, copy the contents of the old 63 // Create a new render target and, if necessary, copy the contents of the old
64 // render target into it. Note that this flushes the SkGpuDevice but 64 // render target into it. Note that this flushes the SkGpuDevice but
65 // doesn't force an OpenGL flush. 65 // doesn't force an OpenGL flush.
66 void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) { 66 void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) {
67 GrRenderTarget* rt = fDevice->accessRenderTarget(); 67 GrRenderTarget* rt = fDevice->accessRenderTarget();
68 // are we sharing our render target with the image? Note this call should ne ver create a new 68 // are we sharing our render target with the image? Note this call should ne ver create a new
69 // image because onCopyOnWrite is only called when there is a cached image. 69 // image because onCopyOnWrite is only called when there is a cached image.
70 SkImage* image = this->getCachedImage(kNo_Budgeted); 70 SkImage* image = this->getCachedImage(kNo_Budgeted);
71 SkASSERT(image); 71 SkASSERT(image);
72 if (rt->asTexture() == image->getTexture()) { 72 if (rt->asTexture() == as_IB(image)->getTexture()) {
73 this->fDevice->replaceRenderTarget(SkSurface::kRetain_ContentChangeMode == mode); 73 this->fDevice->replaceRenderTarget(SkSurface::kRetain_ContentChangeMode == mode);
74 SkTextureImageApplyBudgetedDecision(image); 74 SkTextureImageApplyBudgetedDecision(image);
75 } else if (kDiscard_ContentChangeMode == mode) { 75 } else if (kDiscard_ContentChangeMode == mode) {
76 this->SkSurface_Gpu::onDiscard(); 76 this->SkSurface_Gpu::onDiscard();
77 } 77 }
78 } 78 }
79 79
80 void SkSurface_Gpu::onDiscard() { 80 void SkSurface_Gpu::onDiscard() {
81 fDevice->accessRenderTarget()->discard(); 81 fDevice->accessRenderTarget()->discard();
82 } 82 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 115 }
116 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget (), props, 116 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget (), props,
117 SkGpuDevice::kNeedClear _Flag)); 117 SkGpuDevice::kNeedClear _Flag));
118 if (!device) { 118 if (!device) {
119 return NULL; 119 return NULL;
120 } 120 }
121 return SkNEW_ARGS(SkSurface_Gpu, (device)); 121 return SkNEW_ARGS(SkSurface_Gpu, (device));
122 } 122 }
123 123
124 #endif 124 #endif
OLDNEW
« no previous file with comments | « src/image/SkImage_Gpu.cpp ('k') | src/utils/SkDeferredCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698