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 "GrSurfacePriv.h" | 9 #include "GrSurfacePriv.h" |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 GrRenderTarget* target = this->asRenderTarget(); | 36 GrRenderTarget* target = this->asRenderTarget(); |
37 if (target) { | 37 if (target) { |
38 return context->readRenderTargetPixels(target, left, top, width, height,
config, buffer, | 38 return context->readRenderTargetPixels(target, left, top, width, height,
config, buffer, |
39 rowBytes, pixelOpsFlags); | 39 rowBytes, pixelOpsFlags); |
40 } | 40 } |
41 return false; | 41 return false; |
42 } | 42 } |
43 | 43 |
44 SkImageInfo GrSurface::info() const { | 44 SkImageInfo GrSurface::info() const { |
45 SkColorType colorType; | 45 SkColorType colorType; |
46 if (!GrPixelConfig2ColorType(this->config(), &colorType)) { | 46 SkColorProfileType profileType; |
| 47 if (!GrPixelConfig2ColorAndProfileType(this->config(), &colorType, &profileT
ype)) { |
47 sk_throw(); | 48 sk_throw(); |
48 } | 49 } |
49 return SkImageInfo::Make(this->width(), this->height(), colorType, kPremul_S
kAlphaType); | 50 return SkImageInfo::Make(this->width(), this->height(), colorType, kPremul_S
kAlphaType, |
| 51 profileType); |
50 } | 52 } |
51 | 53 |
52 // TODO: This should probably be a non-member helper function. It might only be
needed in | 54 // TODO: This should probably be a non-member helper function. It might only be
needed in |
53 // debug or developer builds. | 55 // debug or developer builds. |
54 bool GrSurface::savePixels(const char* filename) { | 56 bool GrSurface::savePixels(const char* filename) { |
55 SkBitmap bm; | 57 SkBitmap bm; |
56 if (!bm.tryAllocPixels(SkImageInfo::MakeN32Premul(this->width(), this->heigh
t()))) { | 58 if (!bm.tryAllocPixels(SkImageInfo::MakeN32Premul(this->width(), this->heigh
t()))) { |
57 return false; | 59 return false; |
58 } | 60 } |
59 | 61 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 const GrTexture* thisTex = this->asTexture(); | 118 const GrTexture* thisTex = this->asTexture(); |
117 if (thisTex && thisTex->internalHasPendingIO()) { | 119 if (thisTex && thisTex->internalHasPendingIO()) { |
118 return true; | 120 return true; |
119 } | 121 } |
120 const GrRenderTarget* thisRT = this->asRenderTarget(); | 122 const GrRenderTarget* thisRT = this->asRenderTarget(); |
121 if (thisRT && thisRT->internalHasPendingIO()) { | 123 if (thisRT && thisRT->internalHasPendingIO()) { |
122 return true; | 124 return true; |
123 } | 125 } |
124 return false; | 126 return false; |
125 } | 127 } |
OLD | NEW |