aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-05-24 23:12:41 +0000
committerGravatar vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-05-24 23:12:41 +0000
commit13d14a9dbd2cf0a9654045cc967e92626690631a (patch)
tree131a07d3d525815d4f2aa39fdee5e74f0d818e3e
parent61d267879bdf85c84b05f0519eb53b9322abbf0e (diff)
[PDF] Rename ContentEntryAccessor to ScopedContentEntry.
Review URL: http://codereview.appspot.com/4515134 git-svn-id: http://skia.googlecode.com/svn/trunk@1416 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--include/pdf/SkPDFDevice.h5
-rw-r--r--src/pdf/SkPDFDevice.cpp42
2 files changed, 23 insertions, 24 deletions
diff --git a/include/pdf/SkPDFDevice.h b/include/pdf/SkPDFDevice.h
index 1ddf2167f0..2a9aba5984 100644
--- a/include/pdf/SkPDFDevice.h
+++ b/include/pdf/SkPDFDevice.h
@@ -36,7 +36,6 @@ class SkPDFShader;
class SkPDFStream;
// Private classes.
-class ContentEntryAccessor;
struct ContentEntry;
struct GraphicStateEntry;
@@ -147,7 +146,7 @@ private:
friend class SkPDFDeviceFactory;
// TODO(vandebo) push most of SkPDFDevice's state into a core object in
// order to get the right access levels without using friend.
- friend class ContentEntryAccessor;
+ friend class ScopedContentEntry;
SkISize fPageSize;
SkISize fContentSize;
@@ -183,7 +182,7 @@ private:
// If the paint or clip is such that we shouldn't draw anything, this
// returns NULL and does not create a content entry.
// setUpContentEntry and finishContentEntry can be used directly, but
- // the preferred method is to use the ContentEntryAccessor helper class.
+ // the preferred method is to use the ScopedContentEntry helper class.
ContentEntry* setUpContentEntry(const SkClipStack* clipStack,
const SkRegion& clipRegion,
const SkMatrix& matrix,
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 17ea5ddb5c..1fe1734e93 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -413,25 +413,25 @@ struct ContentEntry {
// A helper class to automatically finish a ContentEntry at the end of a
// drawing method and maintain the state needed between set up and finish.
-class ContentEntryAccessor {
+class ScopedContentEntry {
public:
- ContentEntryAccessor(SkPDFDevice* device, const SkDraw& draw,
- const SkPaint& paint, bool hasText = false)
+ ScopedContentEntry(SkPDFDevice* device, const SkDraw& draw,
+ const SkPaint& paint, bool hasText = false)
: fDevice(device),
fContentEntry(NULL),
fXfermode(SkXfermode::kSrcOver_Mode) {
init(draw.fClipStack, *draw.fClip, *draw.fMatrix, paint, hasText);
}
- ContentEntryAccessor(SkPDFDevice* device, const SkClipStack* clipStack,
- const SkRegion& clipRegion, const SkMatrix& matrix,
- const SkPaint& paint, bool hasText = false)
+ ScopedContentEntry(SkPDFDevice* device, const SkClipStack* clipStack,
+ const SkRegion& clipRegion, const SkMatrix& matrix,
+ const SkPaint& paint, bool hasText = false)
: fDevice(device),
fContentEntry(NULL),
fXfermode(SkXfermode::kSrcOver_Mode) {
init(clipStack, clipRegion, matrix, paint, hasText);
}
- ~ContentEntryAccessor() {
+ ~ScopedContentEntry() {
if (fContentEntry) {
fDevice->finishContentEntry(fXfermode, fDstFormXObject.get());
}
@@ -555,15 +555,15 @@ void SkPDFDevice::clear(SkColor color) {
paint.setStyle(SkPaint::kFill_Style);
SkMatrix identity;
identity.reset();
- ContentEntryAccessor content(this, &fExistingClipStack, fExistingClipRegion,
- identity, paint);
+ ScopedContentEntry content(this, &fExistingClipStack, fExistingClipRegion,
+ identity, paint);
internalDrawPaint(paint, content.entry());
}
void SkPDFDevice::drawPaint(const SkDraw& d, const SkPaint& paint) {
SkPaint newPaint = paint;
newPaint.setStyle(SkPaint::kFill_Style);
- ContentEntryAccessor content(this, d, newPaint);
+ ScopedContentEntry content(this, d, newPaint);
internalDrawPaint(newPaint, content.entry());
}
@@ -630,7 +630,7 @@ void SkPDFDevice::drawPoints(const SkDraw& d, SkCanvas::PointMode mode,
}
}
- ContentEntryAccessor content(this, d, *paint);
+ ScopedContentEntry content(this, d, *paint);
if (!content.entry()) {
return;
}
@@ -681,7 +681,7 @@ void SkPDFDevice::drawRect(const SkDraw& d, const SkRect& r,
return;
}
- ContentEntryAccessor content(this, d, paint);
+ ScopedContentEntry content(this, d, paint);
if (!content.entry()) {
return;
}
@@ -733,7 +733,7 @@ void SkPDFDevice::drawPath(const SkDraw& d, const SkPath& origPath,
return;
}
- ContentEntryAccessor content(this, d, paint);
+ ScopedContentEntry content(this, d, paint);
if (!content.entry()) {
return;
}
@@ -769,7 +769,7 @@ void SkPDFDevice::drawSprite(const SkDraw& d, const SkBitmap& bitmap,
void SkPDFDevice::drawText(const SkDraw& d, const void* text, size_t len,
SkScalar x, SkScalar y, const SkPaint& paint) {
SkPaint textPaint = calculate_text_paint(paint);
- ContentEntryAccessor content(this, d, textPaint, true);
+ ScopedContentEntry content(this, d, textPaint, true);
if (!content.entry()) {
return;
}
@@ -843,7 +843,7 @@ void SkPDFDevice::drawPosText(const SkDraw& d, const void* text, size_t len,
int scalarsPerPos, const SkPaint& paint) {
SkASSERT(1 == scalarsPerPos || 2 == scalarsPerPos);
SkPaint textPaint = calculate_text_paint(paint);
- ContentEntryAccessor content(this, d, textPaint, true);
+ ScopedContentEntry content(this, d, textPaint, true);
if (!content.entry()) {
return;
}
@@ -926,7 +926,7 @@ void SkPDFDevice::drawDevice(const SkDraw& d, SkDevice* device, int x, int y,
SkMatrix matrix;
matrix.setTranslate(SkIntToScalar(x), SkIntToScalar(y));
- ContentEntryAccessor content(this, d.fClipStack, *d.fClip, matrix, paint);
+ ScopedContentEntry content(this, d.fClipStack, *d.fClip, matrix, paint);
if (!content.entry()) {
return;
}
@@ -1125,7 +1125,7 @@ void SkPDFDevice::drawFormXObjectWithClip(SkPDFFormXObject* xobject,
sMaskGS->unref(); // SkRefPtr and getSMaskGraphicState both took a ref.
// Draw the xobject with the clip as a mask.
- ContentEntryAccessor content(this, &fExistingClipStack, fExistingClipRegion,
+ ScopedContentEntry content(this, &fExistingClipStack, fExistingClipRegion,
identity, stockPaint);
if (!content.entry()) {
return;
@@ -1262,9 +1262,9 @@ void SkPDFDevice::finishContentEntry(const SkXfermode::Mode xfermode,
SkMatrix identity;
identity.reset();
SkPaint stockPaint;
- ContentEntryAccessor inClipContentEntry(this, &fExistingClipStack,
- fExistingClipRegion, identity,
- stockPaint);
+ ScopedContentEntry inClipContentEntry(this, &fExistingClipStack,
+ fExistingClipRegion, identity,
+ stockPaint);
if (!inClipContentEntry.entry()) {
return;
}
@@ -1446,7 +1446,7 @@ void SkPDFDevice::internalDrawBitmap(const SkMatrix& matrix,
scaled.postScale(SkIntToScalar(subset.width()),
SkIntToScalar(subset.height()));
scaled.postConcat(matrix);
- ContentEntryAccessor content(this, clipStack, clipRegion, scaled, paint);
+ ScopedContentEntry content(this, clipStack, clipRegion, scaled, paint);
if (!content.entry()) {
return;
}