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 23 matching lines...) Loading... |
34 return false; | 34 return false; |
35 } | 35 } |
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(SkAlphaType alphaType) const { |
45 SkColorType colorType; | 45 SkColorType colorType; |
46 SkColorProfileType profileType; | 46 SkColorProfileType profileType; |
47 if (!GrPixelConfig2ColorAndProfileType(this->config(), &colorType, &profileT
ype)) { | 47 if (!GrPixelConfig2ColorAndProfileType(this->config(), &colorType, &profileT
ype)) { |
48 sk_throw(); | 48 sk_throw(); |
49 } | 49 } |
50 return SkImageInfo::Make(this->width(), this->height(), colorType, kPremul_S
kAlphaType, | 50 return SkImageInfo::Make(this->width(), this->height(), colorType, alphaType
, |
51 profileType); | 51 profileType); |
52 } | 52 } |
53 | 53 |
54 // 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 |
55 // debug or developer builds. | 55 // debug or developer builds. |
56 bool GrSurface::savePixels(const char* filename) { | 56 bool GrSurface::savePixels(const char* filename) { |
57 SkBitmap bm; | 57 SkBitmap bm; |
58 if (!bm.tryAllocPixels(SkImageInfo::MakeN32Premul(this->width(), this->heigh
t()))) { | 58 if (!bm.tryAllocPixels(SkImageInfo::MakeN32Premul(this->width(), this->heigh
t()))) { |
59 return false; | 59 return false; |
60 } | 60 } |
(...skipping 67 matching lines...) Loading... |
128 | 128 |
129 void GrSurface::onRelease() { | 129 void GrSurface::onRelease() { |
130 this->invokeReleaseProc(); | 130 this->invokeReleaseProc(); |
131 this->INHERITED::onRelease(); | 131 this->INHERITED::onRelease(); |
132 } | 132 } |
133 | 133 |
134 void GrSurface::onAbandon() { | 134 void GrSurface::onAbandon() { |
135 this->invokeReleaseProc(); | 135 this->invokeReleaseProc(); |
136 this->INHERITED::onAbandon(); | 136 this->INHERITED::onAbandon(); |
137 } | 137 } |
OLD | NEW |