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_Base.h" | 8 #include "SkSurface_Base.h" |
9 #include "SkImagePriv.h" | 9 #include "SkImagePriv.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 fDevice->imageInfo(), | 76 fDevice->imageInfo(), |
77 rt->numSamples())); | 77 rt->numSamples())); |
78 SkASSERT(newDevice.get()); | 78 SkASSERT(newDevice.get()); |
79 | 79 |
80 if (kRetain_ContentChangeMode == mode) { | 80 if (kRetain_ContentChangeMode == mode) { |
81 fDevice->context()->copyTexture(rt->asTexture(), | 81 fDevice->context()->copyTexture(rt->asTexture(), |
82 reinterpret_cast<GrRenderTarget*>(newDevice->accessRenderTarget(
))); | 82 reinterpret_cast<GrRenderTarget*>(newDevice->accessRenderTarget(
))); |
83 } | 83 } |
84 SkASSERT(NULL != this->getCachedCanvas()); | 84 SkASSERT(NULL != this->getCachedCanvas()); |
85 SkASSERT(this->getCachedCanvas()->getDevice() == fDevice); | 85 SkASSERT(this->getCachedCanvas()->getDevice() == fDevice); |
86 this->getCachedCanvas()->setDevice(newDevice); | 86 this->getCachedCanvas()->setRootDevice(newDevice); |
87 SkRefCnt_SafeAssign(fDevice, newDevice.get()); | 87 SkRefCnt_SafeAssign(fDevice, newDevice.get()); |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 /////////////////////////////////////////////////////////////////////////////// | 91 /////////////////////////////////////////////////////////////////////////////// |
92 | 92 |
93 SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget* target) { | 93 SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget* target) { |
94 if (NULL == target) { | 94 if (NULL == target) { |
95 return NULL; | 95 return NULL; |
96 } | 96 } |
(...skipping 14 matching lines...) Expand all Loading... |
111 desc.fConfig = SkBitmapConfig2GrPixelConfig(config); | 111 desc.fConfig = SkBitmapConfig2GrPixelConfig(config); |
112 desc.fSampleCnt = sampleCount; | 112 desc.fSampleCnt = sampleCount; |
113 | 113 |
114 SkAutoTUnref<GrTexture> tex(ctx->createUncachedTexture(desc, NULL, 0)); | 114 SkAutoTUnref<GrTexture> tex(ctx->createUncachedTexture(desc, NULL, 0)); |
115 if (NULL == tex) { | 115 if (NULL == tex) { |
116 return NULL; | 116 return NULL; |
117 } | 117 } |
118 | 118 |
119 return SkNEW_ARGS(SkSurface_Gpu, (tex->asRenderTarget())); | 119 return SkNEW_ARGS(SkSurface_Gpu, (tex->asRenderTarget())); |
120 } | 120 } |
OLD | NEW |