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

Unified Diff: experimental/PdfViewer/SkPdfBasics.h

Issue 21919003: pdfviewer: implementation of one type of pattern - simple tile patern, colored, with xstep and yste… (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « experimental/PdfViewer/PdfReference-okular-1.txt ('k') | experimental/PdfViewer/SkPdfRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/PdfViewer/SkPdfBasics.h
===================================================================
--- experimental/PdfViewer/SkPdfBasics.h (revision 10423)
+++ experimental/PdfViewer/SkPdfBasics.h (working copy)
@@ -20,7 +20,7 @@
class SkPdfAllocator;
// TODO(edisonn): better class design.
-struct SkPdfColorOperator {
+class SkPdfColorOperator {
/*
color space name or array The current color space in which color values are to be interpreted
@@ -31,9 +31,12 @@
// TODO(edisonn): implement the array part too
// does not own the char*
+// TODO(edisonn): remove this public, let fields be private
+// TODO(edisonn): make color space an enum!
+public:
NotOwnedString fColorSpace;
+ SkPdfObject* fPattern;
-
/*
color (various) The current color to be used during painting operations (see Section
4.5, “Color Spaces”). The type and interpretation of this parameter
@@ -45,17 +48,31 @@
SkColor fColor;
double fOpacity; // ca or CA
+
// TODO(edisonn): add here other color space options.
+public:
void setRGBColor(SkColor color) {
// TODO(edisonn): ASSERT DeviceRGB is the color space.
+ fPattern = NULL;
fColor = color;
}
// TODO(edisonn): double check the default values for all fields.
- SkPdfColorOperator() : fColor(SK_ColorBLACK), fOpacity(1) {
- NotOwnedString::init(&fColorSpace);
+ SkPdfColorOperator() : fPattern(NULL), fColor(SK_ColorBLACK), fOpacity(1) {
+ NotOwnedString::init(&fColorSpace, "DeviceRGB");
}
+ void setColorSpace(NotOwnedString* colorSpace) {
+ fColorSpace = *colorSpace;
+ fPattern = NULL;
+ }
+
+ void setPatternColorSpace(SkPdfObject* pattern) {
+ fColorSpace.fBuffer = (const unsigned char*)"Pattern";
+ fColorSpace.fBytes = 7; // strlen("Pattern")
+ fPattern = pattern;
+ }
+
void applyGraphicsState(SkPaint* paint) {
paint->setColor(SkColorSetA(fColor, (U8CPU)(fOpacity * 255)));
}
« no previous file with comments | « experimental/PdfViewer/PdfReference-okular-1.txt ('k') | experimental/PdfViewer/SkPdfRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698