* On failure, the bitmap will be set to empty and return false.
*/
bool allocPixels(const SkImageInfo&, SkPixelRefFactory*, SkColorTable*);
-
+
/**
* Allocate a pixelref to match the specified image info, using the default
* allocator.
bool allocPixels(const SkImageInfo& info) {
return this->allocPixels(info, NULL, NULL);
}
-
+
/**
* Install a pixelref that wraps the specified pixels and rowBytes, and
* optional ReleaseProc and context. When the pixels are no longer
bool installPixels(const SkImageInfo&, void* pixels, size_t rowBytes,
void (*ReleaseProc)(void* addr, void* context),
void* context);
-
+
/**
* If the bitmap's config can be represented as SkImageInfo, return true,
* and if info is not-null, set it to the bitmap's info. If it cannot be
class ManagedTextContext : public TextContextClass {
public:
~ManagedTextContext() {}
-
+
ManagedTextContext(GrContext* context,
const GrPaint& grPaint,
const SkPaint& skPaint,
GrTTextContextManager<TextContextClass>* fManager;
};
-
+
public:
GrTTextContextManager() {
fAllocation = sk_malloc_throw(sizeof(ManagedTextContext));
bool SkBitmap::allocPixels(Allocator* allocator, SkColorTable* ctable) {
HeapAllocator stdalloc;
-
+
if (NULL == allocator) {
allocator = &stdalloc;
}
if (NULL == factory) {
factory = &defaultFactory;
}
-
+
SkPixelRef* pr = factory->create(info, ctable);
if (NULL == pr) {
return reset_return_false(this);
SkColorTable* ctable) {
return SkMallocPixelRef::NewAllocate(info, info.minRowBytes(), ctable);
}
-
if (fDrawProcs) {
delete fDrawProcs;
}
-
+
delete fTextContextManager;
// The GrContext takes a ref on the target. We don't want to cause the render
SkAutoTDelete<GrTextContext> context(fTextContextManager->create(fContext, grPaint, paint));
GrDistanceFieldTextContext* dfContext =
static_cast<GrDistanceFieldTextContext*>(context.get());
-
+
SkAutoGlyphCache autoCache(dfContext->getSkPaint(), &this->fLeakyProperties, NULL);
SkGlyphCache* cache = autoCache.getCache();
GrFontScaler* fontScaler = get_gr_font_scaler(cache);
-
+
dfContext->drawPosText((const char *)text, byteLength, pos, constY, scalarsPerPos,
cache, fontScaler);
#endif