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

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

Issue 1154293002: don't use accessBitmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/SkSurface_Gpu.h ('k') | src/utils/SkCanvasStateUtils.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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 image = SkNEW_ARGS(SkImage_Gpu, 53 image = SkNEW_ARGS(SkImage_Gpu,
54 (info.width(), info.height(), info.alphaType(), 54 (info.width(), info.height(), info.alphaType(),
55 tex, sampleCount, budgeted)); 55 tex, sampleCount, budgeted));
56 } 56 }
57 if (image) { 57 if (image) {
58 as_IB(image)->initWithProps(this->props()); 58 as_IB(image)->initWithProps(this->props());
59 } 59 }
60 return image; 60 return image;
61 } 61 }
62 62
63 void SkSurface_Gpu::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y,
64 const SkPaint* paint) {
65 canvas->drawBitmap(fDevice->accessBitmap(false), x, y, paint);
66 }
67
68 // 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
69 // render target into it. Note that this flushes the SkGpuDevice but 64 // render target into it. Note that this flushes the SkGpuDevice but
70 // doesn't force an OpenGL flush. 65 // doesn't force an OpenGL flush.
71 void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) { 66 void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) {
72 GrRenderTarget* rt = fDevice->accessRenderTarget(); 67 GrRenderTarget* rt = fDevice->accessRenderTarget();
73 // 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
74 // 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.
75 SkImage* image = this->getCachedImage(kNo_Budgeted); 70 SkImage* image = this->getCachedImage(kNo_Budgeted);
76 SkASSERT(image); 71 SkASSERT(image);
77 if (rt->asTexture() == image->getTexture()) { 72 if (rt->asTexture() == image->getTexture()) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 115 }
121 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget (), props, 116 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget (), props,
122 SkGpuDevice::kNeedClear _Flag)); 117 SkGpuDevice::kNeedClear _Flag));
123 if (!device) { 118 if (!device) {
124 return NULL; 119 return NULL;
125 } 120 }
126 return SkNEW_ARGS(SkSurface_Gpu, (device)); 121 return SkNEW_ARGS(SkSurface_Gpu, (device));
127 } 122 }
128 123
129 #endif 124 #endif
OLDNEW
« no previous file with comments | « src/image/SkSurface_Gpu.h ('k') | src/utils/SkCanvasStateUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698