Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: src/image/SkImage.cpp

Issue 15806010: Separate core and images project. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Change FORCE_LINKING to be more specific. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/animator/SkSnapshot.cpp ('k') | src/image/SkImage_Codec.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkImage_Base.h"
9 #include "SkImagePriv.h"
10 #include "SkBitmap.h" 8 #include "SkBitmap.h"
11 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkImagePriv.h"
11 #include "SkImage_Base.h"
12 12
13 SK_DEFINE_INST_COUNT(SkImage) 13 SK_DEFINE_INST_COUNT(SkImage)
14 14
15 static SkImage_Base* asIB(SkImage* image) { 15 static SkImage_Base* as_IB(SkImage* image) {
16 return static_cast<SkImage_Base*>(image); 16 return static_cast<SkImage_Base*>(image);
17 } 17 }
18 18
19 static const SkImage_Base* as_IB(const SkImage* image) {
20 return static_cast<const SkImage_Base*>(image);
21 }
22
19 uint32_t SkImage::NextUniqueID() { 23 uint32_t SkImage::NextUniqueID() {
20 static int32_t gUniqueID; 24 static int32_t gUniqueID;
21 25
22 // never return 0; 26 // never return 0;
23 uint32_t id; 27 uint32_t id;
24 do { 28 do {
25 id = sk_atomic_inc(&gUniqueID) + 1; 29 id = sk_atomic_inc(&gUniqueID) + 1;
26 } while (0 == id); 30 } while (0 == id);
27 return id; 31 return id;
28 } 32 }
29 33
30 void SkImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y, 34 void SkImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y,
31 const SkPaint* paint) { 35 const SkPaint* paint) {
32 asIB(this)->onDraw(canvas, x, y, paint); 36 as_IB(this)->onDraw(canvas, x, y, paint);
33 } 37 }
34 38
35 GrTexture* SkImage::getTexture() { 39 GrTexture* SkImage::getTexture() {
36 return asIB(this)->onGetTexture(); 40 return as_IB(this)->onGetTexture();
37 } 41 }
42
43 SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const {
44 SkBitmap bm;
45 if (as_IB(this)->getROPixels(&bm)) {
46 return SkImageEncoder::EncodeData(bm, type, quality);
47 }
48 return NULL;
49 }
OLDNEW
« no previous file with comments | « src/animator/SkSnapshot.cpp ('k') | src/image/SkImage_Codec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698