diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-10-31 16:24:08 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-10-31 16:24:08 +0000 |
commit | 081560e3abe25c4821b79ca1465f4dbd371c4b5c (patch) | |
tree | c6b87adb0a09e54eee77ba3363956738a1b7967f /src | |
parent | 94bdd7e3fcf493f827263bd922cb09fb4b50df4c (diff) |
add SK_ATTR_DEPRECATED -- will need to disable for chrome, since it triggers a warning
BUG=
R=robertphillips@google.com, senorblanco@chromium.org, vandebo@chromium.org
Review URL: https://codereview.chromium.org/51033004
git-svn-id: http://skia.googlecode.com/svn/trunk@12055 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
41 files changed, 139 insertions, 136 deletions
diff --git a/src/animator/SkDrawPaint.cpp b/src/animator/SkDrawPaint.cpp index 22d99e4f21..825d0486a7 100644 --- a/src/animator/SkDrawPaint.cpp +++ b/src/animator/SkDrawPaint.cpp @@ -220,7 +220,7 @@ void SkDrawPaint::setupPaint(SkPaint* paint) const { if (fakeBold != -1) paint->setFakeBoldText(SkToBool(fakeBold)); if (filterBitmap != -1) - paint->setFilterBitmap(SkToBool(filterBitmap)); + paint->setFilterLevel(filterBitmap ? SkPaint::kLow_FilterLevel : SkPaint::kNone_FilterLevel); // stroke is legacy; style setting if present overrides stroke if (stroke != -1) paint->setStyle(SkToBool(stroke) ? SkPaint::kStroke_Style : SkPaint::kFill_Style); diff --git a/src/core/SkBBoxHierarchyRecord.cpp b/src/core/SkBBoxHierarchyRecord.cpp index 61a82cef3d..8e5861bb21 100644 --- a/src/core/SkBBoxHierarchyRecord.cpp +++ b/src/core/SkBBoxHierarchyRecord.cpp @@ -22,7 +22,7 @@ SkBBoxHierarchyRecord::SkBBoxHierarchyRecord(uint32_t recordFlags, void SkBBoxHierarchyRecord::handleBBox(const SkRect& bounds) { SkIRect r; bounds.roundOut(&r); - SkPictureStateTree::Draw* draw = fStateTree->appendDraw(this->writeStream().size()); + SkPictureStateTree::Draw* draw = fStateTree->appendDraw(this->writeStream().bytesWritten()); fBoundingHierarchy->insert(draw, r, true); } @@ -33,7 +33,7 @@ int SkBBoxHierarchyRecord::save(SaveFlags flags) { int SkBBoxHierarchyRecord::saveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags) { - fStateTree->appendSaveLayer(this->writeStream().size()); + fStateTree->appendSaveLayer(this->writeStream().bytesWritten()); return INHERITED::saveLayer(bounds, paint, flags); } @@ -80,27 +80,27 @@ void SkBBoxHierarchyRecord::setMatrix(const SkMatrix& matrix) { bool SkBBoxHierarchyRecord::clipRect(const SkRect& rect, SkRegion::Op op, bool doAntiAlias) { - fStateTree->appendClip(this->writeStream().size()); + fStateTree->appendClip(this->writeStream().bytesWritten()); return INHERITED::clipRect(rect, op, doAntiAlias); } bool SkBBoxHierarchyRecord::clipRegion(const SkRegion& region, SkRegion::Op op) { - fStateTree->appendClip(this->writeStream().size()); + fStateTree->appendClip(this->writeStream().bytesWritten()); return INHERITED::clipRegion(region, op); } bool SkBBoxHierarchyRecord::clipPath(const SkPath& path, SkRegion::Op op, bool doAntiAlias) { - fStateTree->appendClip(this->writeStream().size()); + fStateTree->appendClip(this->writeStream().bytesWritten()); return INHERITED::clipPath(path, op, doAntiAlias); } bool SkBBoxHierarchyRecord::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAntiAlias) { - fStateTree->appendClip(this->writeStream().size()); + fStateTree->appendClip(this->writeStream().bytesWritten()); return INHERITED::clipRRect(rrect, op, doAntiAlias); } @@ -109,7 +109,7 @@ bool SkBBoxHierarchyRecord::shouldRewind(void* data) { // SkPicture has rewound its command stream. To match that rewind in the // BBH, we rewind all draws that reference commands that were recorded // past the point to which the SkPicture has rewound, which is given by - // writeStream().size(). + // writeStream().bytesWritten(). SkPictureStateTree::Draw* draw = static_cast<SkPictureStateTree::Draw*>(data); - return draw->fOffset >= writeStream().size(); + return draw->fOffset >= writeStream().bytesWritten(); } diff --git a/src/core/SkBBoxRecord.cpp b/src/core/SkBBoxRecord.cpp index 1e6c69ba09..2349b1c3e1 100644 --- a/src/core/SkBBoxRecord.cpp +++ b/src/core/SkBBoxRecord.cpp @@ -32,7 +32,7 @@ void SkBBoxRecord::drawPath(const SkPath& path, const SkPaint& paint) { // path's device-space bounding box. SkIRect clipBounds; if (this->getClipDeviceBounds(&clipBounds)) { - this->handleBBox(SkRect::MakeFromIRect(clipBounds)); + this->handleBBox(SkRect::Make(clipBounds)); INHERITED::drawPath(path, paint); } } else if (this->transformBounds(path.getBounds(), &paint)) { diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index 2f1c9a49ad..bff08801fc 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -502,11 +502,11 @@ size_t SkBitmap::getSafeSize() const { // This is intended to be a size_t version of ComputeSafeSize64(), just // faster. The computation is meant to be identical. return (fHeight ? ((fHeight - 1) * fRowBytes) + - ComputeRowBytes(getConfig(), fWidth): 0); + ComputeRowBytes(this->config(), fWidth): 0); } Sk64 SkBitmap::getSafeSize64() const { - return ComputeSafeSize64(getConfig(), fWidth, fHeight, fRowBytes); + return ComputeSafeSize64(this->config(), fWidth, fHeight, fRowBytes); } bool SkBitmap::copyPixelsTo(void* const dst, size_t dstSize, @@ -516,12 +516,12 @@ bool SkBitmap::copyPixelsTo(void* const dst, size_t dstSize, dstRowBytes = fRowBytes; } - if (dstRowBytes < ComputeRowBytes(getConfig(), fWidth) || + if (dstRowBytes < ComputeRowBytes(this->config(), fWidth) || dst == NULL || (getPixels() == NULL && pixelRef() == NULL)) return false; if (!preserveDstPad && static_cast<uint32_t>(dstRowBytes) == fRowBytes) { - size_t safeSize = getSafeSize(); + size_t safeSize = this->getSafeSize(); if (safeSize > dstSize || safeSize == 0) return false; else { @@ -535,12 +535,12 @@ bool SkBitmap::copyPixelsTo(void* const dst, size_t dstSize, } } else { // If destination has different stride than us, then copy line by line. - if (ComputeSafeSize(getConfig(), fWidth, fHeight, dstRowBytes) > + if (ComputeSafeSize(this->config(), fWidth, fHeight, dstRowBytes) > dstSize) return false; else { // Just copy what we need on each line. - size_t rowBytes = ComputeRowBytes(getConfig(), fWidth); + size_t rowBytes = ComputeRowBytes(this->config(), fWidth); SkAutoLockPixels lock(*this); const uint8_t* srcP = reinterpret_cast<const uint8_t*>(getPixels()); uint8_t* dstP = reinterpret_cast<uint8_t*>(dst); @@ -874,7 +874,7 @@ void SkBitmap::eraseArea(const SkIRect& rect, SkColor c) const { * within the bounds of the SkPixelRef being used. */ static size_t get_sub_offset(const SkBitmap& bm, int x, int y) { - switch (bm.getConfig()) { + switch (bm.config()) { case SkBitmap::kA8_Config: case SkBitmap:: kIndex8_Config: // x is fine as is for the calculation @@ -1005,7 +1005,7 @@ bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const { #include "SkPaint.h" bool SkBitmap::canCopyTo(Config dstConfig) const { - if (this->getConfig() == kNo_Config) { + if (this->config() == kNo_Config) { return false; } @@ -1028,7 +1028,7 @@ bool SkBitmap::canCopyTo(Config dstConfig) const { } // do not copy src if srcConfig == kA1_Config while dstConfig != kA1_Config - if (this->getConfig() == kA1_Config && !sameConfigs) { + if (this->config() == kA1_Config && !sameConfigs) { return false; } @@ -1305,7 +1305,7 @@ void SkBitmap::buildMipMap(bool forceRebuild) { void (*proc)(SkBitmap* dst, int x, int y, const SkBitmap& src); - const SkBitmap::Config config = this->getConfig(); + const SkBitmap::Config config = this->config(); switch (config) { case kARGB_8888_Config: @@ -1444,7 +1444,7 @@ static bool GetBitmapAlpha(const SkBitmap& src, uint8_t* SK_RESTRICT alpha, SkASSERT(alpha != NULL); SkASSERT(alphaRowBytes >= src.width()); - SkBitmap::Config config = src.getConfig(); + SkBitmap::Config config = src.config(); int w = src.width(); int h = src.height(); size_t rb = src.rowBytes(); diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp index ff68481538..eac21e2d48 100644 --- a/src/core/SkBitmapDevice.cpp +++ b/src/core/SkBitmapDevice.cpp @@ -13,8 +13,8 @@ SK_DEFINE_INST_COUNT(SkBitmapDevice) -#define CHECK_FOR_NODRAW_ANNOTATION(paint) \ - do { if (paint.isNoDrawAnnotation()) { return; } } while (0) +#define CHECK_FOR_ANNOTATION(paint) \ + do { if (paint.getAnnotation()) { return; } } while (0) SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap) : fBitmap(bitmap) { @@ -210,17 +210,17 @@ void SkBitmapDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { void SkBitmapDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, size_t count, const SkPoint pts[], const SkPaint& paint) { - CHECK_FOR_NODRAW_ANNOTATION(paint); + CHECK_FOR_ANNOTATION(paint); draw.drawPoints(mode, count, pts, paint); } void SkBitmapDevice::drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& paint) { - CHECK_FOR_NODRAW_ANNOTATION(paint); + CHECK_FOR_ANNOTATION(paint); draw.drawRect(r, paint); } void SkBitmapDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) { - CHECK_FOR_NODRAW_ANNOTATION(paint); + CHECK_FOR_ANNOTATION(paint); SkPath path; path.addOval(oval); @@ -230,7 +230,7 @@ void SkBitmapDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPa } void SkBitmapDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const SkPaint& paint) { - CHECK_FOR_NODRAW_ANNOTATION(paint); + CHECK_FOR_ANNOTATION(paint); SkPath path; path.addRRect(rrect); @@ -242,7 +242,7 @@ void SkBitmapDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const S void SkBitmapDevice::drawPath(const SkDraw& draw, const SkPath& path, const SkPaint& paint, const SkMatrix* prePathMatrix, bool pathIsMutable) { - CHECK_FOR_NODRAW_ANNOTATION(paint); + CHECK_FOR_ANNOTATION(paint); draw.drawPath(path, paint, prePathMatrix, pathIsMutable); } diff --git a/src/core/SkBitmapHeap.cpp b/src/core/SkBitmapHeap.cpp index f3428db64f..a17113842f 100644 --- a/src/core/SkBitmapHeap.cpp +++ b/src/core/SkBitmapHeap.cpp @@ -259,7 +259,7 @@ bool SkBitmapHeap::copyBitmap(const SkBitmap& originalBitmap, SkBitmap& copiedBi // copiedBitmap.setPixelRef(sharedPixelRef, originalBitmap.pixelRefOffset()); } else if (originalBitmap.empty()) { copiedBitmap.reset(); - } else if (!originalBitmap.deepCopyTo(&copiedBitmap, originalBitmap.getConfig())) { + } else if (!originalBitmap.deepCopyTo(&copiedBitmap, originalBitmap.config())) { return false; } copiedBitmap.setImmutable(); diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp index 6ba82bf077..f4e1a37c80 100644 --- a/src/core/SkBlitter.cpp +++ b/src/core/SkBlitter.cpp @@ -857,7 +857,7 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device, // which check, in case we're being called by a client with a dummy device // (e.g. they have a bounder that always aborts the draw) - if (SkBitmap::kNo_Config == device.getConfig()) { + if (SkBitmap::kNo_Config == device.config()) { SK_PLACEMENT_NEW(blitter, SkNullBlitter, storage, storageSize); return blitter; } @@ -940,7 +940,7 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device, return blitter; } - switch (device.getConfig()) { + switch (device.config()) { case SkBitmap::kA1_Config: SK_PLACEMENT_NEW_ARGS(blitter, SkA1_Blitter, storage, storageSize, (device, *paint)); diff --git a/src/core/SkBlitter_Sprite.cpp b/src/core/SkBlitter_Sprite.cpp index db7cc69a78..9322e20396 100644 --- a/src/core/SkBlitter_Sprite.cpp +++ b/src/core/SkBlitter_Sprite.cpp @@ -66,7 +66,7 @@ SkBlitter* SkBlitter::ChooseSprite( const SkBitmap& device, SkSpriteBlitter* blitter; - switch (device.getConfig()) { + switch (device.config()) { case SkBitmap::kRGB_565_Config: blitter = SkSpriteBlitter::ChooseD16(source, paint, storage, storageSize); diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 6036186fc2..32a6e09ba8 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -1307,7 +1307,7 @@ bool SkCanvas::updateClipConservativelyUsingBounds(const SkRect& bounds, SkRegio SkRect deviceBounds; SkIRect deviceIBounds; this->getDevice()->getGlobalBounds(&deviceIBounds); - deviceBounds = SkRect::MakeFromIRect(deviceIBounds); + deviceBounds = SkRect::Make(deviceIBounds); this->SkCanvas::save(SkCanvas::kMatrix_SaveFlag); // set the clip in device space this->SkCanvas::setMatrix(SkMatrix::I()); diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index d2d618090e..df73f7ae37 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -1156,7 +1156,7 @@ static bool just_translate(const SkMatrix& matrix, const SkBitmap& bitmap) { void SkDraw::drawBitmapAsMask(const SkBitmap& bitmap, const SkPaint& paint) const { - SkASSERT(bitmap.getConfig() == SkBitmap::kA8_Config); + SkASSERT(bitmap.config() == SkBitmap::kA8_Config); if (just_translate(*fMatrix, bitmap)) { int ix = SkScalarRound(fMatrix->getTranslateX()); @@ -1264,7 +1264,7 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix, // nothing to draw if (fRC->isEmpty() || bitmap.width() == 0 || bitmap.height() == 0 || - bitmap.getConfig() == SkBitmap::kNo_Config) { + bitmap.config() == SkBitmap::kNo_Config) { return; } @@ -1290,7 +1290,7 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix, } } - if (bitmap.getConfig() != SkBitmap::kA8_Config && + if (bitmap.config() != SkBitmap::kA8_Config && just_translate(matrix, bitmap)) { // // It is safe to call lock pixels now, since we know the matrix is @@ -1323,7 +1323,7 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix, SkDraw draw(*this); draw.fMatrix = &matrix; - if (bitmap.getConfig() == SkBitmap::kA8_Config) { + if (bitmap.config() == SkBitmap::kA8_Config) { draw.drawBitmapAsMask(bitmap, paint); } else { SkAutoBitmapShaderInstall install(bitmap, paint); @@ -1343,7 +1343,7 @@ void SkDraw::drawSprite(const SkBitmap& bitmap, int x, int y, // nothing to draw if (fRC->isEmpty() || bitmap.width() == 0 || bitmap.height() == 0 || - bitmap.getConfig() == SkBitmap::kNo_Config) { + bitmap.config() == SkBitmap::kNo_Config) { return; } diff --git a/src/core/SkMipMap.cpp b/src/core/SkMipMap.cpp index 0673c7e093..4888b574e4 100644 --- a/src/core/SkMipMap.cpp +++ b/src/core/SkMipMap.cpp @@ -129,7 +129,7 @@ SkMipMap::Level* SkMipMap::AllocLevels(int levelCount, size_t pixelSize) { SkMipMap* SkMipMap::Build(const SkBitmap& src) { void (*proc)(SkBitmap* dst, int x, int y, const SkBitmap& src); - const SkBitmap::Config config = src.getConfig(); + const SkBitmap::Config config = src.config(); switch (config) { case SkBitmap::kARGB_8888_Config: proc = downsampleby2_proc32; diff --git a/src/core/SkOrderedWriteBuffer.cpp b/src/core/SkOrderedWriteBuffer.cpp index 1c15e43ef0..25ca769168 100644 --- a/src/core/SkOrderedWriteBuffer.cpp +++ b/src/core/SkOrderedWriteBuffer.cpp @@ -310,10 +310,10 @@ void SkOrderedWriteBuffer::writeFlattenable(const SkFlattenable* flattenable) { // make room for the size of the flattened object (void)fWriter.reserve(sizeof(uint32_t)); // record the current size, so we can subtract after the object writes. - uint32_t offset = fWriter.size(); + uint32_t offset = fWriter.bytesWritten(); // now flatten the object flattenObject(flattenable, *this); - uint32_t objSize = fWriter.size() - offset; + uint32_t objSize = fWriter.bytesWritten() - offset; // record the obj's size *fWriter.peek32(offset - sizeof(uint32_t)) = objSize; } diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp index 83f481a91b..94dd6518af 100644 --- a/src/core/SkPath.cpp +++ b/src/core/SkPath.cpp @@ -97,7 +97,8 @@ public: } ~SkAutoPathBoundsUpdate() { - fPath->setIsConvex(fDegenerate); + fPath->setConvexity(fDegenerate ? SkPath::kConvex_Convexity + : SkPath::kUnknown_Convexity); if (fEmpty || fHasValidBounds) { fPath->setBounds(fRect); } diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index 4ce29c8dbb..f2d959d3d6 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -66,10 +66,10 @@ SkPicturePlayback::SkPicturePlayback(const SkPictureRecord& record, bool deepCop record.dumpPaints(); #endif - record.validate(record.writeStream().size(), 0); + record.validate(record.writeStream().bytesWritten(), 0); const SkWriter32& writer = record.writeStream(); init(); - if (writer.size() == 0) { + if (writer.bytesWritten() == 0) { fOpData = SkData::NewEmpty(); return; } @@ -85,7 +85,7 @@ SkPicturePlayback::SkPicturePlayback(const SkPictureRecord& record, bool deepCop } { - size_t size = writer.size(); + size_t size = writer.bytesWritten(); void* buffer = sk_malloc_throw(size); writer.flatten(buffer); SkASSERT(!fOpData); diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index f7a7633faa..c59dfe3d71 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -146,7 +146,7 @@ SkBaseDevice* SkPictureRecord::setDevice(SkBaseDevice* device) { int SkPictureRecord::save(SaveFlags flags) { // record the offset to us, making it non-positive to distinguish a save // from a clip entry. - fRestoreOffsetStack.push(-(int32_t)fWriter.size()); + fRestoreOffsetStack.push(-(int32_t)fWriter.bytesWritten()); // op + flags uint32_t size = kSaveSize; @@ -161,7 +161,7 @@ int SkPictureRecord::saveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags) { // record the offset to us, making it non-positive to distinguish a save // from a clip entry. - fRestoreOffsetStack.push(-(int32_t)fWriter.size()); + fRestoreOffsetStack.push(-(int32_t)fWriter.bytesWritten()); // op + bool for 'bounds' uint32_t size = 2 * kUInt32Size; @@ -175,7 +175,7 @@ int SkPictureRecord::saveLayer(const SkRect* bounds, const SkPaint* paint, size_t initialOffset = this->addDraw(SAVE_LAYER, &size); addRectPtr(bounds); - SkASSERT(initialOffset+getPaintOffset(SAVE_LAYER, size) == fWriter.size()); + SkASSERT(initialOffset+getPaintOffset(SAVE_LAYER, size) == fWriter.bytesWritten()); addPaintPtr(paint); addInt(flags); @@ -248,19 +248,19 @@ struct CommandInfo { */ static bool match(SkWriter32* writer, uint32_t offset, int* pattern, CommandInfo* result, int numCommands) { - SkASSERT(offset < writer->size()); + SkASSERT(offset < writer->bytesWritten()); uint32_t curOffset = offset; uint32_t curSize = 0; int numMatched; - for (numMatched = 0; numMatched < numCommands && curOffset < writer->size(); ++numMatched) { + for (numMatched = 0; numMatched < numCommands && curOffset < writer->bytesWritten(); ++numMatched) { DrawType op = peek_op_and_size(writer, curOffset, &curSize); - while (NOOP == op && curOffset < writer->size()) { + while (NOOP == op && curOffset < writer->bytesWritten()) { curOffset += curSize; op = peek_op_and_size(writer, curOffset, &curSize); } - if (curOffset >= writer->size()) { + if (curOffset >= writer->bytesWritten()) { return false; // ran out of byte stream } @@ -285,7 +285,7 @@ static bool match(SkWriter32* writer, uint32_t offset, } curOffset += curSize; - if (curOffset < writer->size()) { + if (curOffset < writer->bytesWritten()) { // Something else between the last command and the end of the stream return false; } @@ -464,7 +464,7 @@ static bool collapse_save_clip_restore(SkWriter32* writer, int32_t offset, gCollapseCalls += 1; #endif - int32_t restoreOffset = (int32_t)writer->size(); + int32_t restoreOffset = (int32_t)writer->bytesWritten(); // back up to the save block while (offset > 0) { @@ -585,7 +585,7 @@ void SkPictureRecord::restore() { if ((*gPictureRecordOpts[opt].fProc)(&fWriter, fRestoreOffsetStack.top(), &fPaints)) { // Some optimization fired so don't add the RESTORE size = 0; - initialOffset = fWriter.size(); + initialOffset = fWriter.bytesWritten(); apply_optimization_to_bbh(gPictureRecordOpts[opt].fType, fStateTree, fBoundingHierarchy); break; @@ -596,7 +596,7 @@ void SkPictureRecord::restore() { if ((fRecordFlags & SkPicture::kDisableRecordOptimizations_RecordingFlag) || SK_ARRAY_COUNT(gPictureRecordOpts) == opt) { // No optimization fired so add the RESTORE - fillRestoreOffsetPlaceholdersForCurrentStackLevel((uint32_t)fWriter.size()); + fillRestoreOffsetPlaceholdersForCurrentStackLevel((uint32_t)fWriter.bytesWritten()); size = 1 * kUInt32Size; // RESTORE consists solely of 1 op code initialOffset = this->addDraw(RESTORE, &size); } @@ -647,7 +647,7 @@ bool SkPictureRecord::skew(SkScalar sx, SkScalar sy) { } bool SkPictureRecord::concat(const SkMatrix& matrix) { - this->validate(fWriter.size(), 0); + this->validate(fWriter.bytesWritten(), 0); // op + matrix index uint32_t size = 2 * kUInt32Size; size_t initialOffset = this->addDraw(CONCAT, &size); @@ -657,7 +657,7 @@ bool SkPictureRecord::concat(const SkMatrix& matrix) { } void SkPictureRecord::setMatrix(const SkMatrix& matrix) { - this->validate(fWriter.size(), 0); + this->validate(fWriter.bytesWritten(), 0); // op + matrix index uint32_t size = 2 * kUInt32Size; size_t initialOffset = this->addDraw(SET_MATRIX, &size); @@ -734,7 +734,7 @@ void SkPictureRecord::recordRestoreOffsetPlaceholder(SkRegion::Op op) { prevOffset = 0; } - size_t offset = fWriter.size(); + size_t offset = fWriter.bytesWritten(); addInt(prevOffset); fRestoreOffsetStack.top() = offset; } @@ -840,7 +840,7 @@ void SkPictureRecord::drawPaint(const SkPaint& paint) { // op + paint index uint32_t size = 2 * kUInt32Size; size_t initialOffset = this->addDraw(DRAW_PAINT, &size); - SkASSERT(initialOffset+getPaintOffset(DRAW_PAINT, size) == fWriter.size()); + SkASSERT(initialOffset+getPaintOffset(DRAW_PAINT, size) == fWriter.bytesWritten()); addPaint(paint); this->validate(initialOffset, size); } @@ -850,7 +850,7 @@ void SkPictureRecord::drawPoints(PointMode mode, size_t count, const SkPoint pts // op + paint index + mode + count + point data uint32_t size = 4 * kUInt32Size + count * sizeof(SkPoint); size_t initialOffset = this->addDraw(DRAW_POINTS, &size); - SkASSERT(initialOffset+getPaintOffset(DRAW_POINTS, size) == fWriter.size()); + SkASSERT(initialOffset+getPaintOffset(DRAW_POINTS, size) == fWriter.bytesWritten()); addPaint(paint); addInt(mode); addInt(count); @@ -862,7 +862,7 @@ void SkPictureRecord::drawOval(const SkRect& oval, const SkPaint& paint) { // op + paint index + rect uint32_t size = 2 * kUInt32Size + sizeof(oval); size_t initialOffset = this->addDraw(DRAW_OVAL, &size); - SkASSERT(initialOffset+getPaintOffset(DRAW_OVAL, size) == fWriter.size()); + SkASSERT(initialOffset+getPaintOffset(DRAW_OVAL, size) == fWriter.bytesWritten()); addPaint(paint); addRect(oval); this->validate(initialOffset, size); @@ -872,7 +872,7 @@ void SkPictureRecord::drawRect(const SkRect& rect, const SkPaint& paint) { // op + paint index + rect uint32_t size = 2 * kUInt32Size + sizeof(rect); size_t initialOffset = this->addDraw(DRAW_RECT, &size); - SkASSERT(initialOffset+getPaintOffset(DRAW_RECT, size) == fWriter.size()); + SkASSERT(initialOffset+getPaintOffset(DRAW_RECT, size) == fWriter.bytesWritten()); addPaint(paint); addRect(rect); this->validate(initialOffset, size); @@ -888,7 +888,7 @@ void SkPictureRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) { uint32_t initialOffset, size; size = 2 * kUInt32Size + SkRRect::kSizeInMemory; initialOffset = this->addDraw(DRAW_RRECT, &size); - SkASSERT(initialOffset+getPaintOffset(DRAW_RRECT, size) == fWriter.size()); + SkASSERT(initialOffset+getPaintOffset(DRAW_RRECT, size) == fWriter.bytesWritten()); addPaint(paint); addRRect(rrect); this->validate(initialOffset, size); @@ -899,7 +899,7 @@ void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) { // op + paint index + path index uint32_t size = 3 * kUInt32Size; size_t initialOffset = this->addDraw(DRAW_PATH, &size); - SkASSERT(initialOffset+getPaintOffset(DRAW_PATH, size) == fWriter.size()); + SkASSERT(initialOffset+getPaintOffset(DRAW_PATH, size) == fWriter.bytesWritten()); addPaint(paint); addPath(path); this->validate(initialOffset, size); @@ -910,7 +910,7 @@ void SkPictureRecord::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar // op + paint index + bitmap index + left + top uint32_t size = 3 * kUInt32Size + 2 * sizeof(SkScalar); size_t initialOffset = this->addDraw(DRAW_BITMAP, &size); - SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP, size) == fWriter.size()); + SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP, size) == fWriter.bytesWritten()); addPaintPtr(paint); addBitmap(bitmap); addScalar(left); @@ -929,7 +929,7 @@ void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* size += sizeof(dst); // + rect size_t initialOffset = this->addDraw(DRAW_BITMAP_RECT_TO_RECT, &size); - SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_RECT_TO_RECT, size) == fWriter.size()); + SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_RECT_TO_RECT, size) == fWriter.bytesWritten()); addPaintPtr(paint); addBitmap(bitmap); addRectPtr(src); // may be null @@ -943,7 +943,7 @@ void SkPictureRecord::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m // id + paint index + bitmap index + matrix index uint32_t size = 4 * kUInt32Size; size_t initialOffset = this->addDraw(DRAW_BITMAP_MATRIX, &size); - SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_MATRIX, size) == fWriter.size()); + SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_MATRIX, size) == fWriter.bytesWritten()); addPaintPtr(paint); addBitmap(bitmap); addMatrix(matrix); @@ -955,7 +955,7 @@ void SkPictureRecord::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& cent // op + paint index + bitmap id + center + dst rect uint32_t size = 3 * kUInt32Size + sizeof(center) + sizeof(dst); size_t initialOffset = this->addDraw(DRAW_BITMAP_NINE, &size); - SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_NINE, size) == fWriter.size()); + SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_NINE, size) == fWriter.bytesWritten()); addPaintPtr(paint); addBitmap(bitmap); addIRect(center); @@ -968,7 +968,7 @@ void SkPictureRecord::drawSprite(const SkBitmap& bitmap, int left, int top, // op + paint index + bitmap index + left + top uint32_t size = 5 * kUInt32Size; size_t initialOffset = this->addDraw(DRAW_SPRITE, &size); - SkASSERT(initialOffset+getPaintOffset(DRAW_SPRITE, size) == fWriter.size()); + SkASSERT(initialOffset+getPaintOffset(DRAW_SPRITE, size) == fWriter.bytesWritten()); addPaintPtr(paint); addBitmap(bitmap); addInt(left); @@ -1007,7 +1007,7 @@ void SkPictureRecord::drawText(const void* text, size_t byteLength, SkScalar x, DrawType op = fast ? DRAW_TEXT_TOP_BOTTOM : DRAW_TEXT; size_t initialOffset = this->addDraw(op, &size); - SkASSERT(initialOffset+getPaintOffset(op, size) == fWriter.size()); + SkASSERT(initialOffset+getPaintOffset(op, size) == fWriter.bytesWritten()); const SkFlatData* flatPaintData = addPaint(paint); SkASSERT(flatPaintData); addText(text, byteLength); @@ -1073,14 +1073,14 @@ void SkPictureRecord::drawPosText(const void* text, size_t byteLength, op = DRAW_POS_TEXT; } size_t initialOffset = this->addDraw(op, &size); - SkASSERT(initialOffset+getPaintOffset(op, size) == fWriter.size()); + SkASSERT(initialOffset+getPaintOffset(op, size) == fWriter.bytesWritten()); const SkFlatData* flatPaintData = addPaint(paint); SkASSERT(flatPaintData); addText(text, byteLength); addInt(points); #ifdef SK_DEBUG_SIZE - size_t start = fWriter.size(); + size_t start = fWriter.bytesWritten(); #endif if (canUseDrawH) { if (fast) { @@ -1097,7 +1097,7 @@ void SkPictureRecord::drawPosText(const void* text, size_t byteLength, } } #ifdef SK_DEBUG_SIZE - fPointBytes += fWriter.size() - start; + fPointBytes += fWriter.bytesWritten() - start; fPointWrites += points; #endif this->validate(initialOffset, size); @@ -1136,7 +1136,7 @@ void SkPictureRecord::drawPosTextHImpl(const void* text, size_t byteLength, addInt(points); #ifdef SK_DEBUG_SIZE - size_t start = fWriter.size(); + size_t start = fWriter.bytesWritten(); #endif if (fast) { addFontMetricsTopBottom(paint, *flatPaintData, constY, constY); @@ -1144,7 +1144,7 @@ void SkPictureRecord::drawPosTextHImpl(const void* text, size_t byteLength, addScalar(constY); fWriter.writeMul4(xpos, points * sizeof(SkScalar)); #ifdef SK_DEBUG_SIZE - fPointBytes += fWriter.size() - start; + fPointBytes += fWriter.bytesWritten() - start; fPointWrites += points; #endif this->validate(initialOffset, size); @@ -1156,7 +1156,7 @@ void SkPictureRecord::drawTextOnPath(const void* text, size_t byteLength, // op + paint index + length + 'length' worth of data + path index + matrix index uint32_t size = 3 * kUInt32Size + SkAlign4(byteLength) + 2 * kUInt32Size; size_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size); - SkASSERT(initialOffset+getPaintOffset(DRAW_TEXT_ON_PATH, size) == fWriter.size()); + SkASSERT(initialOffset+getPaintOffset(DRAW_TEXT_ON_PATH, size) == fWriter.bytesWritten()); addPaint(paint); addText(text, byteLength); addPath(path); @@ -1202,7 +1202,7 @@ void SkPictureRecord::drawVertices(VertexMode vmode, int vertexCount, } size_t initialOffset = this->addDraw(DRAW_VERTICES, &size); - SkASSERT(initialOffset+getPaintOffset(DRAW_VERTICES, size) == fWriter.size()); + SkASSERT(initialOffset+getPaintOffset(DRAW_VERTICES, size) == fWriter.bytesWritten()); addPaint(paint); addInt(flags); addInt(vmode); @@ -1311,11 +1311,11 @@ void SkPictureRecord::addPicture(SkPicture& picture) { void SkPictureRecord::addPoint(const SkPoint& point) { #ifdef SK_DEBUG_SIZE - size_t start = fWriter.size(); + size_t start = fWriter.bytesWritten(); #endif fWriter.writePoint(point); #ifdef SK_DEBUG_SIZE - fPointBytes += fWriter.size() - start; + fPointBytes += fWriter.bytesWritten() - start; fPointWrites++; #endif } @@ -1330,11 +1330,11 @@ void SkPictureRecord::addPoints(const SkPoint pts[], int count) { void SkPictureRecord::addRect(const SkRect& rect) { #ifdef SK_DEBUG_SIZE - size_t start = fWriter.size(); + size_t start = fWriter.bytesWritten(); #endif fWriter.writeRect(rect); #ifdef SK_DEBUG_SIZE - fRectBytes += fWriter.size() - start; + fRectBytes += fWriter.bytesWritten() - start; fRectWrites++; #endif } @@ -1365,12 +1365,12 @@ void SkPictureRecord::addRegion(const SkRegion& region) { void SkPictureRecord::addText(const void* text, size_t byteLength) { #ifdef SK_DEBUG_SIZE - size_t start = fWriter.size(); + size_t start = fWriter.bytesWritten(); #endif addInt(byteLength); fWriter.writePad(text, byteLength); #ifdef SK_DEBUG_SIZE - fTextBytes += fWriter.size() - start; + fTextBytes += fWriter.bytesWritten() - start; fTextWrites++; #endif } diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h index d80182cf8c..da79fc1bbb 100644 --- a/src/core/SkPictureRecord.h +++ b/src/core/SkPictureRecord.h @@ -131,7 +131,7 @@ private: * operates in this manner. */ size_t addDraw(DrawType drawType, uint32_t* size) { - size_t offset = fWriter.size(); + size_t offset = fWriter.bytesWritten(); this->predrawNotify(); @@ -212,7 +212,7 @@ private: #else public: void validate(size_t initialOffset, uint32_t size) const { - SkASSERT(fWriter.size() == initialOffset + size); + SkASSERT(fWriter.bytesWritten() == initialOffset + size); } #endif diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp index 32f3df4d3c..8f6bfb5d80 100644 --- a/src/core/SkShader.cpp +++ b/src/core/SkShader.cpp @@ -51,7 +51,7 @@ bool SkShader::setContext(const SkBitmap& device, const SkMatrix* m = &matrix; SkMatrix total; - fDeviceConfig = SkToU8(device.getConfig()); + fDeviceConfig = SkToU8(device.config()); fPaintAlpha = paint.getAlpha(); if (this->hasLocalMatrix()) { total.setConcat(matrix, this->getLocalMatrix()); diff --git a/src/core/SkSpriteBlitter_ARGB32.cpp b/src/core/SkSpriteBlitter_ARGB32.cpp index 255ef26d40..8255336c65 100644 --- a/src/core/SkSpriteBlitter_ARGB32.cpp +++ b/src/core/SkSpriteBlitter_ARGB32.cpp @@ -277,7 +277,7 @@ SkSpriteBlitter* SkSpriteBlitter::ChooseD32(const SkBitmap& source, SkColorFilter* filter = paint.getColorFilter(); SkSpriteBlitter* blitter = NULL; - switch (source.getConfig()) { + switch (source.config()) { case SkBitmap::kARGB_4444_Config: if (alpha != 0xFF) { return NULL; // we only have opaque sprites diff --git a/src/core/SkSpriteBlitter_RGB16.cpp b/src/core/SkSpriteBlitter_RGB16.cpp index 8cef76719e..2bce41e993 100644 --- a/src/core/SkSpriteBlitter_RGB16.cpp +++ b/src/core/SkSpriteBlitter_RGB16.cpp @@ -324,7 +324,7 @@ SkSpriteBlitter* SkSpriteBlitter::ChooseD16(const SkBitmap& source, SkSpriteBlitter* blitter = NULL; unsigned alpha = paint.getAlpha(); - switch (source.getConfig()) { + switch (source.config()) { case SkBitmap::kARGB_8888_Config: SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D16_S32_BlitRowProc, storage, storageSize, (source)); diff --git a/src/effects/SkBitmapAlphaThresholdShader.cpp b/src/effects/SkBitmapAlphaThresholdShader.cpp index 1b54425548..226b3173e1 100644 --- a/src/effects/SkBitmapAlphaThresholdShader.cpp +++ b/src/effects/SkBitmapAlphaThresholdShader.cpp @@ -249,7 +249,7 @@ GrEffectRef* BATShader::asNewEffect(GrContext* context, const SkPaint& paint) co context->setMatrix(matrix); while (!iter.done()) { - SkRect rect = SkRect::MakeFromIRect(iter.rect()); + SkRect rect = SkRect::Make(iter.rect()); context->drawRect(grPaint, rect); iter.next(); } diff --git a/src/effects/SkBlurMask.h b/src/effects/SkBlurMask.h index 061cfdec52..e0b8d54ce1 100644 --- a/src/effects/SkBlurMask.h +++ b/src/effects/SkBlurMask.h @@ -44,17 +44,19 @@ public: Style style, SkIPoint* margin = NULL); - // DEPRECATED - radius-based + SK_ATTR_DEPRECATED("use sigma version") static bool BlurRect(SkMask *dst, const SkRect &src, SkScalar radius, Style style, SkIPoint *margin = NULL, SkMask::CreateMode createMode = SkMask::kComputeBoundsAndRenderImage_CreateMode); - // DEPRECATED - radius-based + + SK_ATTR_DEPRECATED("use sigma version") static bool Blur(SkMask* dst, const SkMask& src, SkScalar radius, Style style, Quality quality, SkIPoint* margin = NULL); - // DEPRECATED - radius-based + + SK_ATTR_DEPRECATED("use sigma version") static bool BlurGroundTruth(SkMask* dst, const SkMask& src, SkScalar radius, Style style, SkIPoint* margin = NULL); diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index 6a5a39778c..5b72a6c800 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -386,7 +386,7 @@ bool SkBlurMaskFilterImpl::canFilterMaskGPU(const SkRect& srcBounds, float sigma3 = 3 * SkScalarToFloat(xformedSigma); - SkRect clipRect = SkRect::MakeFromIRect(clipBounds); + SkRect clipRect = SkRect::Make(clipBounds); SkRect srcRect(srcBounds); // Outset srcRect and clipRect by 3 * sigma, to compute affected blur area. diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 52c01fe0d6..152ec560bd 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -501,7 +501,7 @@ void apply_morphology_pass(GrContext* context, direction, radius, morphType))->unref(); - context->drawRectToRect(paint, SkRect::MakeFromIRect(dstRect), SkRect::MakeFromIRect(srcRect)); + context->drawRectToRect(paint, SkRect::Make(dstRect), SkRect::Make(srcRect)); } bool apply_morphology(const SkBitmap& input, diff --git a/src/effects/SkTestImageFilters.cpp b/src/effects/SkTestImageFilters.cpp index d0e21a3920..289113133c 100755 --- a/src/effects/SkTestImageFilters.cpp +++ b/src/effects/SkTestImageFilters.cpp @@ -48,7 +48,7 @@ bool SkDownSampleImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, OwnDeviceCanvas canvas(dev); SkPaint paint; - paint.setFilterBitmap(true); + paint.setFilterLevel(SkPaint::kLow_FilterLevel); canvas.scale(scale, scale); canvas.drawBitmap(src, 0, 0, &paint); tmp = dev->accessBitmap(false); diff --git a/src/effects/SkTransparentShader.cpp b/src/effects/SkTransparentShader.cpp index 0274481623..970e74faa8 100644 --- a/src/effects/SkTransparentShader.cpp +++ b/src/effects/SkTransparentShader.cpp @@ -23,7 +23,7 @@ bool SkTransparentShader::setContext(const SkBitmap& device, uint32_t SkTransparentShader::getFlags() { uint32_t flags = this->INHERITED::getFlags(); - switch (fDevice->getConfig()) { + switch (fDevice->config()) { case SkBitmap::kRGB_565_Config: flags |= kHasSpan16_Flag; if (fAlpha == 255) @@ -42,7 +42,7 @@ uint32_t SkTransparentShader::getFlags() { void SkTransparentShader::shadeSpan(int x, int y, SkPMColor span[], int count) { unsigned scale = SkAlpha255To256(fAlpha); - switch (fDevice->getConfig()) { + switch (fDevice->config()) { case SkBitmap::kARGB_8888_Config: if (scale == 256) { SkPMColor* src = fDevice->getAddr32(x, y); @@ -103,7 +103,7 @@ void SkTransparentShader::shadeSpan(int x, int y, SkPMColor span[], int count) { } void SkTransparentShader::shadeSpan16(int x, int y, uint16_t span[], int count) { - SkASSERT(fDevice->getConfig() == SkBitmap::kRGB_565_Config); + SkASSERT(fDevice->config() == SkBitmap::kRGB_565_Config); uint16_t* src = fDevice->getAddr16(x, y); if (src != span) { diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp index c8713b63ad..e2597dfad8 100644 --- a/src/gpu/GrClipMaskManager.cpp +++ b/src/gpu/GrClipMaskManager.cpp @@ -366,7 +366,7 @@ void GrClipMaskManager::mergeMask(GrTexture* dstMask, GrTextureDomainEffect::MakeTexelDomain(srcMask, srcBound), GrTextureDomainEffect::kDecal_WrapMode, GrTextureParams::kNone_FilterMode))->unref(); - fGpu->drawSimpleRect(SkRect::MakeFromIRect(dstBound), NULL); + fGpu->drawSimpleRect(SkRect::Make(dstBound), NULL); } // get a texture to act as a temporary buffer for AA clip boolean operations @@ -722,7 +722,7 @@ bool GrClipMaskManager::createStencilClipMask(InitialState initialState, SET_RANDOM_COLOR // The view matrix is setup to do clip space -> stencil space translation, so // draw rect in clip space. - fGpu->drawSimpleRect(SkRect::MakeFromIRect(clipSpaceIBounds), NULL); + fGpu->drawSimpleRect(SkRect::Make(clipSpaceIBounds), NULL); } } } @@ -961,7 +961,7 @@ GrTexture* GrClipMaskManager::createSoftwareClipMask(int32_t clipStackGenID, // but leave the pixels inside the geometry alone. For reverse difference we invert all // the pixels before clearing the ones outside the geometry. if (SkRegion::kReverseDifference_Op == op) { - SkRect temp = SkRect::MakeFromIRect(clipSpaceIBounds); + SkRect temp = SkRect::Make(clipSpaceIBounds); // invert the entire scene helper.draw(temp, SkRegion::kXOR_Op, false, 0xFF); } diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h index c75bba2a10..6a1cc02133 100644 --- a/src/gpu/GrDrawTarget.h +++ b/src/gpu/GrDrawTarget.h @@ -362,7 +362,7 @@ public: this->drawRect(rect, matrix, NULL, NULL); } void drawSimpleRect(const SkIRect& irect, const SkMatrix* matrix = NULL) { - SkRect rect = SkRect::MakeFromIRect(irect); + SkRect rect = SkRect::Make(irect); this->drawRect(rect, matrix, NULL, NULL); } diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp index e426de358a..a299512538 100644 --- a/src/gpu/GrInOrderDrawBuffer.cpp +++ b/src/gpu/GrInOrderDrawBuffer.cpp @@ -213,7 +213,7 @@ bool GrInOrderDrawBuffer::quickInsideClip(const SkRect& devBounds) { // free via the viewport. We don't want to think that clipping must be enabled in this // case. So we extend the clip outward from the edge to avoid these false negatives. fClipProxyState = kValid_ClipProxyState; - fClipProxy = SkRect::MakeFromIRect(rect); + fClipProxy = SkRect::Make(rect); if (fClipProxy.fLeft <= 0) { fClipProxy.fLeft = SK_ScalarMin; diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp index 2b6583e3e3..a5f4519ea7 100644 --- a/src/gpu/GrReducedClip.cpp +++ b/src/gpu/GrReducedClip.cpp @@ -51,7 +51,7 @@ void ReduceClipStack(const SkClipStack& stack, const SkIRect* bounds = &queryBounds; - SkRect scalarQueryBounds = SkRect::MakeFromIRect(queryBounds); + SkRect scalarQueryBounds = SkRect::Make(queryBounds); if (iior) { SkASSERT(SkClipStack::kNormal_BoundsType == stackBoundsType); @@ -67,7 +67,7 @@ void ReduceClipStack(const SkClipStack& stack, } else if (isectRect.intersect(stackBounds, scalarQueryBounds)) { if (NULL != tighterBounds) { isectRect.roundOut(tighterBounds); - SkRect scalarTighterBounds = SkRect::MakeFromIRect(*tighterBounds); + SkRect scalarTighterBounds = SkRect::Make(*tighterBounds); if (scalarTighterBounds == isectRect) { // the round-out didn't add any area outside the clip rect. *requiresAA = false; @@ -119,7 +119,7 @@ void ReduceClipStack(const SkClipStack& stack, } } - SkRect scalarBounds = SkRect::MakeFromIRect(*bounds); + SkRect scalarBounds = SkRect::Make(*bounds); // Now that we have determined the bounds to use and filtered out the trivial cases, call the // helper that actually walks the stack. diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 730dad620c..f47a91bf50 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -53,8 +53,8 @@ /////////////////////////////////////////////////////////////////////////////// -#define CHECK_FOR_NODRAW_ANNOTATION(paint) \ - do { if (paint.isNoDrawAnnotation()) { return; } } while (0) +#define CHECK_FOR_ANNOTATION(paint) \ + do { if (paint.getAnnotation()) { return; } } while (0) /////////////////////////////////////////////////////////////////////////////// @@ -572,7 +572,7 @@ static const GrPrimitiveType gPointMode2PrimtiveType[] = { void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, size_t count, const SkPoint pts[], const SkPaint& paint) { - CHECK_FOR_NODRAW_ANNOTATION(paint); + CHECK_FOR_ANNOTATION(paint); CHECK_SHOULD_DRAW(draw, false); SkScalar width = paint.getStrokeWidth(); @@ -606,7 +606,7 @@ void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, const SkPaint& paint) { - CHECK_FOR_NODRAW_ANNOTATION(paint); + CHECK_FOR_ANNOTATION(paint); CHECK_SHOULD_DRAW(draw, false); bool doStroke = paint.getStyle() != SkPaint::kFill_Style; @@ -662,7 +662,7 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, const SkPaint& paint) { - CHECK_FOR_NODRAW_ANNOTATION(paint); + CHECK_FOR_ANNOTATION(paint); CHECK_SHOULD_DRAW(draw, false); bool usePath = !rect.isSimple(); @@ -695,7 +695,7 @@ void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) { - CHECK_FOR_NODRAW_ANNOTATION(paint); + CHECK_FOR_ANNOTATION(paint); CHECK_SHOULD_DRAW(draw, false); bool usePath = false; @@ -787,7 +787,7 @@ bool draw_with_mask_filter(GrContext* context, const SkPath& devPath, texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig, dstM.fImage, dstM.fRowBytes); - SkRect maskRect = SkRect::MakeFromIRect(dstM.fBounds); + SkRect maskRect = SkRect::Make(dstM.fBounds); return draw_mask(context, maskRect, grp, texture); } @@ -860,7 +860,7 @@ SkBitmap wrap_texture(GrTexture* texture) { void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath, const SkPaint& paint, const SkMatrix* prePathMatrix, bool pathIsMutable) { - CHECK_FOR_NODRAW_ANNOTATION(paint); + CHECK_FOR_ANNOTATION(paint); CHECK_SHOULD_DRAW(draw, false); GrPaint grPaint; @@ -1017,7 +1017,7 @@ static void determine_clipped_src_rect(const GrContext* context, clippedSrcIRect->setEmpty(); return; } - SkRect clippedSrcRect = SkRect::MakeFromIRect(*clippedSrcIRect); + SkRect clippedSrcRect = SkRect::Make(*clippedSrcIRect); inv.mapRect(&clippedSrcRect); if (NULL != srcRectPtr) { if (!clippedSrcRect.intersect(*srcRectPtr)) { @@ -1236,7 +1236,7 @@ void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap, const SkPaint& paint, SkCanvas::DrawBitmapRectFlags flags, int tileSize) { - SkRect clippedSrcRect = SkRect::MakeFromIRect(clippedSrcIRect); + SkRect clippedSrcRect = SkRect::Make(clippedSrcIRect); int nx = bitmap.width() / tileSize; int ny = bitmap.height() / tileSize; diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp index 89bd0597c8..74c80bc73f 100644 --- a/src/images/SkImageDecoder.cpp +++ b/src/images/SkImageDecoder.cpp @@ -229,7 +229,7 @@ bool SkImageDecoder::cropBitmap(SkBitmap *dst, SkBitmap *src, int sampleSize, int srcX, int srcY) { int w = width / sampleSize; int h = height / sampleSize; - if (src->getConfig() == SkBitmap::kIndex8_Config) { + if (src->config() == SkBitmap::kIndex8_Config) { // kIndex8 does not allow drawing via an SkCanvas, as is done below. // Instead, use extractSubset. Note that this shares the SkPixelRef and // SkColorTable. @@ -245,7 +245,7 @@ bool SkImageDecoder::cropBitmap(SkBitmap *dst, SkBitmap *src, int sampleSize, } // if the destination has no pixels then we must allocate them. if (dst->isNull()) { - dst->setConfig(src->getConfig(), w, h, 0, src->alphaType()); + dst->setConfig(src->config(), w, h, 0, src->alphaType()); if (!this->allocPixelRef(dst, NULL)) { SkDEBUGF(("failed to allocate pixels needed to crop the bitmap")); diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp index 68014dd392..ab58aef135 100644 --- a/src/images/SkImageDecoder_libwebp.cpp +++ b/src/images/SkImageDecoder_libwebp.cpp @@ -521,7 +521,7 @@ private: bool SkWEBPImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bm, int quality) { - const SkBitmap::Config config = bm.getConfig(); + const SkBitmap::Config config = bm.config(); const ScanlineImporter scanline_import = ChooseImporter(config); if (NULL == scanline_import) { return false; diff --git a/src/images/SkImageEncoder_argb.cpp b/src/images/SkImageEncoder_argb.cpp index 5abc23ce6f..97b741b8bf 100644 --- a/src/images/SkImageEncoder_argb.cpp +++ b/src/images/SkImageEncoder_argb.cpp @@ -87,7 +87,7 @@ static ScanlineImporter ChooseImporter(const SkBitmap::Config& config) { } bool SkARGBImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap, int) { - const SkBitmap::Config config = bitmap.getConfig(); + const SkBitmap::Config config = bitmap.config(); const ScanlineImporter scanline_import = ChooseImporter(config); if (NULL == scanline_import) { return false; diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index d8e7b1394a..77aa7a353c 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -1607,13 +1607,13 @@ bool SkPDFDevice::handleRectAnnotation(const SkRect& r, const SkMatrix& matrix, SkData* urlData = annotationInfo->find(SkAnnotationKeys::URL_Key()); if (urlData) { handleLinkToURL(urlData, r, matrix); - return p.isNoDrawAnnotation(); + return p.getAnnotation() != NULL; } SkData* linkToName = annotationInfo->find( SkAnnotationKeys::Link_Named_Dest_Key()); if (linkToName) { handleLinkToNamedDest(linkToName, r, matrix); - return p.isNoDrawAnnotation(); + return p.getAnnotation() != NULL; } return false; } @@ -1631,7 +1631,7 @@ bool SkPDFDevice::handlePointAnnotation(const SkPoint* points, size_t count, for (size_t i = 0; i < count; i++) { defineNamedDestination(nameData, points[i], matrix); } - return paint.isNoDrawAnnotation(); + return paint.getAnnotation() != NULL; } return false; } diff --git a/src/pdf/SkPDFImage.cpp b/src/pdf/SkPDFImage.cpp index ed204550e7..c3dc396fc4 100644 --- a/src/pdf/SkPDFImage.cpp +++ b/src/pdf/SkPDFImage.cpp @@ -27,7 +27,7 @@ static bool skip_compression(SkPDFCatalog* catalog) { static size_t get_uncompressed_size(const SkBitmap& bitmap, const SkIRect& srcRect) { - switch (bitmap.getConfig()) { + switch (bitmap.config()) { case SkBitmap::kIndex8_Config: return srcRect.width() * srcRect.height(); case SkBitmap::kARGB_4444_Config: @@ -491,7 +491,7 @@ static SkBitmap unpremultiply_bitmap(const SkBitmap& bitmap, SkPDFImage* SkPDFImage::CreateImage(const SkBitmap& bitmap, const SkIRect& srcRect, SkPicture::EncodeBitmap encoder) { - if (bitmap.getConfig() == SkBitmap::kNo_Config) { + if (bitmap.config() == SkBitmap::kNo_Config) { return NULL; } @@ -569,7 +569,7 @@ SkPDFImage::SkPDFImage(SkStream* stream, fStreamValid = false; } - SkBitmap::Config config = fBitmap.getConfig(); + SkBitmap::Config config = fBitmap.config(); insertName("Type", "XObject"); insertName("Subtype", "Image"); diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp index 50043c6a2d..b61de1c912 100644 --- a/src/pipe/SkGPipeWrite.cpp +++ b/src/pipe/SkGPipeWrite.cpp @@ -294,7 +294,7 @@ private: inline void doNotify() { if (!fDone) { - size_t bytes = fWriter.size() - fBytesNotified; + size_t bytes = fWriter.bytesWritten() - fBytesNotified; if (bytes > 0) { fController->notifyWritten(bytes); fBytesNotified += bytes; @@ -467,7 +467,7 @@ bool SkGPipeCanvas::needOpBytes(size_t needed) { } needed += 4; // size of DrawOp atom - if (fWriter.size() + needed > fBlockSize) { + if (fWriter.bytesWritten() + needed > fBlockSize) { // Before we wipe out any data that has already been written, read it // out. this->doNotify(); diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageDecoder_CG.cpp index 3f850b544d..9b93f81112 100644 --- a/src/ports/SkImageDecoder_CG.cpp +++ b/src/ports/SkImageDecoder_CG.cpp @@ -219,7 +219,7 @@ bool SkImageEncoder_CG::onEncode(SkWStream* stream, const SkBitmap& bm, // format. // <Error>: CGImageDestinationFinalize image destination does not have enough images // So instead we copy to 8888. - if (bm.getConfig() == SkBitmap::kARGB_4444_Config) { + if (bm.config() == SkBitmap::kARGB_4444_Config) { bm.copyTo(&bitmap8888, SkBitmap::kARGB_8888_Config); bmPtr = &bitmap8888; } diff --git a/src/utils/SkCanvasStateUtils.cpp b/src/utils/SkCanvasStateUtils.cpp index c62bc04e11..9c7d8fab3a 100644 --- a/src/utils/SkCanvasStateUtils.cpp +++ b/src/utils/SkCanvasStateUtils.cpp @@ -171,7 +171,7 @@ static void setup_MC_state(SkMCState* state, const SkMatrix& matrix, const SkReg } // allocate memory for the clip then and copy them to the struct - state->clipRects = (ClipRect*) sk_malloc_throw(clipWriter.size()); + state->clipRects = (ClipRect*) sk_malloc_throw(clipWriter.bytesWritten()); clipWriter.flatten(state->clipRects); } @@ -239,9 +239,9 @@ SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas* canvas) { } // allocate memory for the layers and then and copy them to the struct - SkASSERT(layerWriter.size() == layerCount * sizeof(SkCanvasLayerState)); + SkASSERT(layerWriter.bytesWritten() == layerCount * sizeof(SkCanvasLayerState)); canvasState->layerCount = layerCount; - canvasState->layers = (SkCanvasLayerState*) sk_malloc_throw(layerWriter.size()); + canvasState->layers = (SkCanvasLayerState*) sk_malloc_throw(layerWriter.bytesWritten()); layerWriter.flatten(canvasState->layers); // for now, just ignore any client supplied DrawFilter. diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h index 7d1166286a..3df31513b4 100644 --- a/src/utils/debugger/SkDebugCanvas.h +++ b/src/utils/debugger/SkDebugCanvas.h @@ -109,8 +109,8 @@ public: /** Returns the vector of draw commands - DEPRECATED: please use getDrawCommandAt and getSize instead */ + SK_ATTR_DEPRECATED("please use getDrawCommandAt and getSize instead") const SkTDArray<SkDrawCommand*>& getDrawCommands() const; /** diff --git a/src/utils/debugger/SkObjectParser.cpp b/src/utils/debugger/SkObjectParser.cpp index 9dd77c0d73..107e04a258 100644 --- a/src/utils/debugger/SkObjectParser.cpp +++ b/src/utils/debugger/SkObjectParser.cpp @@ -31,7 +31,7 @@ SkString* SkObjectParser::BitmapToString(const SkBitmap& bitmap) { SkASSERT(SkBitmap::kConfigCount == 7); mBitmap->append(" Config: "); - mBitmap->append(gConfigStrings[bitmap.getConfig()]); + mBitmap->append(gConfigStrings[bitmap.config()]); if (bitmap.isOpaque()) { mBitmap->append(" opaque"); diff --git a/src/views/SkWindow.cpp b/src/views/SkWindow.cpp index d6fe32bd88..32914502d9 100644 --- a/src/views/SkWindow.cpp +++ b/src/views/SkWindow.cpp @@ -117,7 +117,7 @@ void SkWindow::eraseARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) void SkWindow::eraseRGB(U8CPU r, U8CPU g, U8CPU b) { - fBitmap.eraseRGB(r, g, b); + fBitmap.eraseARGB(0xFF, r, g, b); } bool SkWindow::handleInval(const SkRect* localR) |