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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 SkImageInfo GrSurface::info(SkAlphaType alphaType) const { | 119 SkImageInfo GrSurface::info(SkAlphaType alphaType) const { |
120 SkColorType colorType; | 120 SkColorType colorType; |
121 sk_sp<SkColorSpace> colorSpace; | 121 SkColorProfileType profileType; |
122 if (!GrPixelConfigToColorAndColorSpace(this->config(), &colorType, &colorSpa
ce)) { | 122 if (!GrPixelConfig2ColorAndProfileType(this->config(), &colorType, &profileT
ype)) { |
123 sk_throw(); | 123 sk_throw(); |
124 } | 124 } |
125 return SkImageInfo::Make(this->width(), this->height(), colorType, alphaType
, colorSpace); | 125 return SkImageInfo::Make(this->width(), this->height(), colorType, alphaType
, |
| 126 profileType); |
126 } | 127 } |
127 | 128 |
128 // TODO: This should probably be a non-member helper function. It might only be
needed in | 129 // TODO: This should probably be a non-member helper function. It might only be
needed in |
129 // debug or developer builds. | 130 // debug or developer builds. |
130 bool GrSurface::savePixels(const char* filename) { | 131 bool GrSurface::savePixels(const char* filename) { |
131 SkBitmap bm; | 132 SkBitmap bm; |
132 if (!bm.tryAllocPixels(SkImageInfo::MakeN32Premul(this->width(), this->heigh
t()))) { | 133 if (!bm.tryAllocPixels(SkImageInfo::MakeN32Premul(this->width(), this->heigh
t()))) { |
133 return false; | 134 return false; |
134 } | 135 } |
135 | 136 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 203 |
203 void GrSurface::onRelease() { | 204 void GrSurface::onRelease() { |
204 this->invokeReleaseProc(); | 205 this->invokeReleaseProc(); |
205 this->INHERITED::onRelease(); | 206 this->INHERITED::onRelease(); |
206 } | 207 } |
207 | 208 |
208 void GrSurface::onAbandon() { | 209 void GrSurface::onAbandon() { |
209 this->invokeReleaseProc(); | 210 this->invokeReleaseProc(); |
210 this->INHERITED::onAbandon(); | 211 this->INHERITED::onAbandon(); |
211 } | 212 } |
OLD | NEW |