1 /* 2 * Copyright 2012 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #include "SkImage_Base.h" 9 #include "SkImagePriv.h" 10 #include "SkBitmap.h" 11 #include "SkCanvas.h" 12 SK_DEFINE_INST_COUNT(SkImage)13SK_DEFINE_INST_COUNT(SkImage) 14 15 static SkImage_Base* asIB(SkImage* image) { 16 return static_cast<SkImage_Base*>(image); 17 } 18 NextUniqueID()19uint32_t SkImage::NextUniqueID() { 20 static int32_t gUniqueID; 21 22 // never return 0; 23 uint32_t id; 24 do { 25 id = sk_atomic_inc(&gUniqueID) + 1; 26 } while (0 == id); 27 return id; 28 } 29 draw(SkCanvas * canvas,SkScalar x,SkScalar y,const SkPaint * paint)30void SkImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y, 31 const SkPaint* paint) { 32 asIB(this)->onDraw(canvas, x, y, paint); 33 } 34