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 "GrSurface.h" | 8 #include "GrSurface.h" |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrSurfacePriv.h" | 10 #include "GrSurfacePriv.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 uint32_t pixelOpsFlags) { | 109 uint32_t pixelOpsFlags) { |
110 // go through context so that all necessary flushing occurs | 110 // go through context so that all necessary flushing occurs |
111 GrContext* context = this->getContext(); | 111 GrContext* context = this->getContext(); |
112 if (nullptr == context) { | 112 if (nullptr == context) { |
113 return false; | 113 return false; |
114 } | 114 } |
115 return context->readSurfacePixels(this, left, top, width, height, config, bu
ffer, | 115 return context->readSurfacePixels(this, left, top, width, height, config, bu
ffer, |
116 rowBytes, pixelOpsFlags); | 116 rowBytes, pixelOpsFlags); |
117 } | 117 } |
118 | 118 |
| 119 bool GrSurface::writePixelsWithColorSpace(int left, int top, int width, int heig
ht, |
| 120 GrPixelConfig config, |
| 121 const SkColorSpace* srcColorSpace, |
| 122 const SkColorSpace* dstColorSpace, |
| 123 const void* buffer, size_t rowBytes, |
| 124 uint32_t colorSpaceOpsFlags) { |
| 125 // go through context so that all necessary flushing occurs |
| 126 GrContext* context = this->getContext(); |
| 127 if (nullptr == context) { |
| 128 return false; |
| 129 } |
| 130 return context->writeSurfacePixelsWithColorSpace(this, left, top, width, hei
ght, config, |
| 131 srcColorSpace, dstColorSpac
e, buffer, |
| 132 rowBytes, colorSpaceOpsFlag
s); |
| 133 } |
| 134 |
119 SkImageInfo GrSurface::info(SkAlphaType alphaType) const { | 135 SkImageInfo GrSurface::info(SkAlphaType alphaType) const { |
120 SkColorType colorType; | 136 SkColorType colorType; |
121 SkColorProfileType profileType; | 137 SkColorProfileType profileType; |
122 if (!GrPixelConfig2ColorAndProfileType(this->config(), &colorType, &profileT
ype)) { | 138 if (!GrPixelConfig2ColorAndProfileType(this->config(), &colorType, &profileT
ype)) { |
123 sk_throw(); | 139 sk_throw(); |
124 } | 140 } |
125 return SkImageInfo::Make(this->width(), this->height(), colorType, alphaType
, | 141 return SkImageInfo::Make(this->width(), this->height(), colorType, alphaType
, |
126 profileType); | 142 profileType); |
127 } | 143 } |
128 | 144 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 219 |
204 void GrSurface::onRelease() { | 220 void GrSurface::onRelease() { |
205 this->invokeReleaseProc(); | 221 this->invokeReleaseProc(); |
206 this->INHERITED::onRelease(); | 222 this->INHERITED::onRelease(); |
207 } | 223 } |
208 | 224 |
209 void GrSurface::onAbandon() { | 225 void GrSurface::onAbandon() { |
210 this->invokeReleaseProc(); | 226 this->invokeReleaseProc(); |
211 this->INHERITED::onAbandon(); | 227 this->INHERITED::onAbandon(); |
212 } | 228 } |
OLD | NEW |