Revert r8000 due to failures on some buildbots
authorepoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 6 Mar 2013 00:47:22 +0000 (00:47 +0000)
committerepoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 6 Mar 2013 00:47:22 +0000 (00:47 +0000)
git-svn-id: http://skia.googlecode.com/svn/trunk@8001 2bbb7eff-a529-9590-31e7-b0007b416f81

16 files changed:
gm/internal_links.cpp [deleted file]
gyp/gmslides.gypi
include/core/SkAnnotation.h
include/pdf/SkPDFDevice.h
src/core/SkAnnotation.cpp
src/core/SkDevice.cpp
src/gpu/SkGpuDevice.cpp
src/pdf/SkPDFDevice.cpp
src/pdf/SkPDFDocument.cpp
src/pdf/SkPDFPage.cpp
src/pdf/SkPDFPage.h
src/pipe/SkGPipePriv.h
src/pipe/SkGPipeRead.cpp
src/pipe/SkGPipeWrite.cpp
src/ports/SkGlobalInitialization_default.cpp
tests/AnnotationTest.cpp

diff --git a/gm/internal_links.cpp b/gm/internal_links.cpp
deleted file mode 100644 (file)
index f9846e4..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#include "gm.h"
-
-#include "SkAnnotation.h"
-#include "SkData.h"
-
-namespace skiagm {
-
-/** Draws two rectangles. In output formats that support internal links (PDF),
- *  clicking the one labeled "Link to A" should take you to the one labeled
- *  "Target A". Note that you'll need to zoom your PDF viewer in a fair bit in
- *  order for the scrolling to not be blocked by the edge of the document.
- */
-class InternalLinksGM : public GM {
-public:
-    InternalLinksGM() {
-        this->setBGColor(0xFFDDDDDD);
-    }
-
-protected:
-    virtual SkString onShortName() {
-        return SkString("internal_links");
-    }
-
-    virtual SkISize onISize() {
-        return make_isize(700, 500);
-    }
-
-    virtual void onDraw(SkCanvas* canvas) {
-        SkAutoTUnref<SkData> name(SkData::NewWithCString("target-a"));
-
-        canvas->save();
-        canvas->translate(SkIntToScalar(100), SkIntToScalar(100));
-        drawLabeledRect(canvas, "Link to A", 0, 0);
-        SkRect rect = SkRect::MakeXYWH(0, 0, SkIntToScalar(50), SkIntToScalar(20));
-        SkAnnotateLinkToDestination(canvas, rect, name.get());
-        canvas->restore();
-
-        canvas->save();
-        canvas->translate(SkIntToScalar(200), SkIntToScalar(200));
-        SkPoint point = SkPoint::Make(SkIntToScalar(100), SkIntToScalar(50));
-        drawLabeledRect(canvas, "Target A", point.x(), point.y());
-        SkAnnotateNamedDestination(canvas, point, name.get());
-        canvas->restore();
-    }
-
-private:
-    /** Draw an arbitrary rectangle at a given location and label it with some
-     *  text. */
-    void drawLabeledRect(SkCanvas* canvas, const char* text, int x, int y) {
-        SkPaint paint;
-        paint.setColor(SK_ColorBLUE);
-        SkRect rect = SkRect::MakeXYWH(SkIntToScalar(x), SkIntToScalar(y),
-                                       SkIntToScalar(50), SkIntToScalar(20));
-        canvas->drawRect(rect, paint);
-
-        paint.setAntiAlias(true);
-        paint.setTextSize(SkIntToScalar(25));
-        paint.setColor(SK_ColorBLACK);
-        canvas->drawText(text, strlen(text), x, y, paint);
-    }
-
-    typedef GM INHERITED;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-static GM* MyFactory(void*) { return SkNEW(InternalLinksGM); }
-static GMRegistry reg(MyFactory);
-
-}
index ae36de09b4fae86b45091d9f94e7123a3af31d41..0b42eed07abe56346246a4cf8be7a907ce0303ed 100644 (file)
@@ -50,7 +50,6 @@
     '../gm/image.cpp',
     '../gm/imagefiltersbase.cpp',
     '../gm/imagefiltersgraph.cpp',
-    '../gm/internal_links.cpp',
     '../gm/lcdtext.cpp',
     '../gm/linepaths.cpp',
     '../gm/matrixconvolution.cpp',
index bb7f6c443e28bc75328debc92cdf7db08f7e7e25..e1ecf6caf17bd9386bdea84eccef0908a0b50bc4 100644 (file)
@@ -12,7 +12,6 @@
 
 class SkData;
 class SkDataSet;
-class SkPoint;
 class SkStream;
 class SkWStream;
 
@@ -65,18 +64,6 @@ public:
      *  Returns the canonical key whose payload is a URL
      */
     static const char* URL_Key();
-
-    /**
-     *  Returns the canonical key whose payload is the name of a destination to
-     *  be defined.
-     */
-    static const char* Define_Named_Dest_Key();
-
-    /**
-     *  Returns the canonical key whose payload is the name of a destination to
-     *  be linked to.
-     */
-    static const char* Link_Named_Dest_Key();
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -99,30 +86,4 @@ class SkCanvas;
  */
 SK_API void SkAnnotateRectWithURL(SkCanvas*, const SkRect&, SkData*);
 
-/**
- *  Experimental!
- *
- *  Annotate the canvas by associating a name with the specified point.
- *
- *  If the backend of this canvas does not support annotations, this call is
- *  safely ignored.
- *
- *  The caller is responsible for managing its ownership of the SkData.
- */
-SK_API void SkAnnotateNamedDestination(SkCanvas*, const SkPoint&, SkData*);
-
-/**
- *  Experimental!
- *
- *  Annotate the canvas by making the specified rectangle link to a named
- *  destination.
- *
- *  If the backend of this canvas does not support annotations, this call is
- *  safely ignored.
- *
- *  The caller is responsible for managing its ownership of the SkData.
- */
-SK_API void SkAnnotateLinkToDestination(SkCanvas*, const SkRect&, SkData*);
-
-
 #endif
index 90379f9f6b0cb1a8cd57932c3a407b446aaa1856..a13d6175c70157d9b6ab77ffae2fa9074f380bb3 100644 (file)
@@ -17,7 +17,6 @@
 #include "SkRect.h"
 #include "SkRefCnt.h"
 #include "SkStream.h"
-#include "SkTDArray.h"
 #include "SkTScopedPtr.h"
 
 class SkPDFArray;
@@ -34,7 +33,6 @@ class SkPDFStream;
 // Private classes.
 struct ContentEntry;
 struct GraphicStateEntry;
-struct NamedDestination;
 
 /** \class SkPDFDevice
 
@@ -144,12 +142,6 @@ public:
      */
     SK_API const SkTDArray<SkPDFFont*>& getFontResources() const;
 
-    /** Add our named destinations to the supplied dictionary.
-     *  @param dict  Dictionary to add destinations to.
-     *  @param page  The PDF object representing the page for this device.
-     */
-    void appendDestinations(SkPDFDict* dict, SkPDFObject* page);
-
     /** Returns a copy of the media box for this device. The caller is required
      *  to unref() this when it is finished.
      */
@@ -199,7 +191,6 @@ private:
     SkRegion fExistingClipRegion;
     SkPDFArray* fAnnotations;
     SkPDFDict* fResourceDict;
-    SkTDArray<NamedDestination*> fNamedDestinations;
 
     SkTDArray<SkPDFGraphicState*> fGraphicStateResources;
     SkTDArray<SkPDFObject*> fXObjectResources;
@@ -282,17 +273,8 @@ private:
      */
     void copyContentEntriesToData(ContentEntry* entry, SkWStream* data) const;
 
-    bool handleRectAnnotation(const SkRect& r, const SkMatrix& matrix,
-                              const SkPaint& paint);
-    bool handlePointAnnotation(const SkPoint* points, size_t count,
-                               const SkMatrix& matrix, const SkPaint& paint);
-    SkPDFDict* createLinkAnnotation(const SkRect& r, const SkMatrix& matrix);
-    void handleLinkToURL(SkData* urlData, const SkRect& r,
-                         const SkMatrix& matrix);
-    void handleLinkToNamedDest(SkData* nameData, const SkRect& r,
-                               const SkMatrix& matrix);
-    void defineNamedDestination(SkData* nameData, const SkPoint& point,
-                                const SkMatrix& matrix);
+    bool handleAnnotations(const SkRect& r, const SkMatrix& matrix,
+                           const SkPaint& paint);
 
     typedef SkDevice INHERITED;
 };
index 52fa9b79f208d3ff1cde4f8e839e2411bcdd2b75..5e4363e728315db5117f52009d5b87bc9f33f497 100644 (file)
@@ -8,7 +8,6 @@
 #include "SkAnnotation.h"
 #include "SkDataSet.h"
 #include "SkFlattenableBuffers.h"
-#include "SkPoint.h"
 #include "SkStream.h"
 
 SkAnnotation::SkAnnotation(SkDataSet* data, uint32_t flags) {
@@ -43,50 +42,23 @@ const char* SkAnnotationKeys::URL_Key() {
     return "SkAnnotationKey_URL";
 };
 
-const char* SkAnnotationKeys::Define_Named_Dest_Key() {
-    return "SkAnnotationKey_Define_Named_Dest";
-};
-
-const char* SkAnnotationKeys::Link_Named_Dest_Key() {
-    return "SkAnnotationKey_Link_Named_Dest";
-};
-
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "SkCanvas.h"
 
-static void annotate_paint(SkPaint& paint, const char* key, SkData* value) {
-    SkAutoTUnref<SkDataSet> dataset(SkNEW_ARGS(SkDataSet, (key, value)));
-    SkAnnotation* ann = SkNEW_ARGS(SkAnnotation, (dataset,
-                                                  SkAnnotation::kNoDraw_Flag));
-
-    paint.setAnnotation(ann)->unref();
-    SkASSERT(paint.isNoDrawAnnotation());
-}
-
 void SkAnnotateRectWithURL(SkCanvas* canvas, const SkRect& rect, SkData* value) {
     if (NULL == value) {
         return;
     }
-    SkPaint paint;
-    annotate_paint(paint, SkAnnotationKeys::URL_Key(), value);
-    canvas->drawRect(rect, paint);
-}
 
-void SkAnnotateNamedDestination(SkCanvas* canvas, const SkPoint& point, SkData* name) {
-    if (NULL == name) {
-        return;
-    }
-    SkPaint paint;
-    annotate_paint(paint, SkAnnotationKeys::Define_Named_Dest_Key(), name);
-    canvas->drawPoint(point.x(), point.y(), paint);
-}
+    const char* key = SkAnnotationKeys::URL_Key();
+    SkAutoTUnref<SkDataSet> dataset(SkNEW_ARGS(SkDataSet, (key, value)));
+    SkAnnotation* ann = SkNEW_ARGS(SkAnnotation, (dataset,
+                                                  SkAnnotation::kNoDraw_Flag));
 
-void SkAnnotateLinkToDestination(SkCanvas* canvas, const SkRect& rect, SkData* name) {
-    if (NULL == name) {
-        return;
-    }
     SkPaint paint;
-    annotate_paint(paint, SkAnnotationKeys::Link_Named_Dest_Key(), name);
+    paint.setAnnotation(ann)->unref();
+    SkASSERT(paint.isNoDrawAnnotation());
+
     canvas->drawRect(rect, paint);
 }
index 90d41862deb497a04f2bdcf4e091e704aec00db5..78ce0f635d4e8b35196c855dff7fb0813aaf7bea 100644 (file)
@@ -348,7 +348,6 @@ void SkDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
 
 void SkDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, size_t count,
                           const SkPoint pts[], const SkPaint& paint) {
-    CHECK_FOR_NODRAW_ANNOTATION(paint);
     draw.drawPoints(mode, count, pts, paint);
 }
 
index 77c4bd1115ff1f641af9da4a973dedfe31fff8d7..82c26912a3c2d3cc0aa33ae144e7e3e086af5b4b 100644 (file)
@@ -597,7 +597,6 @@ 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_SHOULD_DRAW(draw, false);
 
     SkScalar width = paint.getStrokeWidth();
index 245299639e9da0428dbd672210bb98e3e938b696..eae7ab73f0736deda32d11e0559890c5910164b4 100644 (file)
@@ -645,7 +645,6 @@ void SkPDFDevice::cleanUp(bool clearFontUsage) {
     fShaderResources.unrefAll();
     SkSafeUnref(fAnnotations);
     SkSafeUnref(fResourceDict);
-    fNamedDestinations.deleteAll();
 
     if (clearFontUsage) {
         fFontGlyphUsage->reset();
@@ -704,10 +703,6 @@ void SkPDFDevice::drawPoints(const SkDraw& d, SkCanvas::PointMode mode,
         return;
     }
 
-    if (handlePointAnnotation(points, count, *d.fMatrix, passedPaint)) {
-        return;
-    }
-
     // SkDraw::drawPoints converts to multiple calls to fDevice->drawPath.
     // We only use this when there's a path effect because of the overhead
     // of multiple calls to setUpContentEntry it causes.
@@ -796,7 +791,7 @@ void SkPDFDevice::drawRect(const SkDraw& d, const SkRect& r,
         return;
     }
 
-    if (handleRectAnnotation(r, *d.fMatrix, paint)) {
+    if (handleAnnotations(r, *d.fMatrix, paint)) {
         return;
     }
 
@@ -852,7 +847,7 @@ void SkPDFDevice::drawPath(const SkDraw& d, const SkPath& origPath,
         return;
     }
 
-    if (handleRectAnnotation(pathPtr->getBounds(), *d.fMatrix, paint)) {
+    if (handleAnnotations(pathPtr->getBounds(), *d.fMatrix, paint)) {
         return;
     }
 
@@ -1291,43 +1286,19 @@ SkData* SkPDFDevice::copyContentToData() const {
     return data.copyToData();
 }
 
-bool SkPDFDevice::handleRectAnnotation(const SkRect& r, const SkMatrix& matrix,
-                                       const SkPaint& p) {
+bool SkPDFDevice::handleAnnotations(const SkRect& r, const SkMatrix& matrix,
+                                    const SkPaint& p) {
     SkAnnotation* annotationInfo = p.getAnnotation();
     if (!annotationInfo) {
         return false;
     }
     SkData* urlData = annotationInfo->find(SkAnnotationKeys::URL_Key());
-    if (urlData) {
-        handleLinkToURL(urlData, r, matrix);
-        return p.isNoDrawAnnotation();
-    }
-    SkData* linkToName = annotationInfo->find(SkAnnotationKeys::Link_Named_Dest_Key());
-    if (linkToName) {
-        handleLinkToNamedDest(linkToName, r, matrix);
-        return p.isNoDrawAnnotation();
-    }
-    return false;
-}
-
-bool SkPDFDevice::handlePointAnnotation(const SkPoint* points, size_t count,
-                                        const SkMatrix& matrix,
-                                        const SkPaint& paint) {
-    SkAnnotation* annotationInfo = paint.getAnnotation();
-    if (!annotationInfo) {
+    if (!urlData) {
         return false;
     }
-    SkData* nameData = annotationInfo->find(SkAnnotationKeys::Define_Named_Dest_Key());
-    if (nameData) {
-        for (size_t i = 0; i < count; i++) {
-            defineNamedDestination(nameData, points[i], matrix);
-        }
-        return paint.isNoDrawAnnotation();
-    }
-    return false;
-}
 
-SkPDFDict* SkPDFDevice::createLinkAnnotation(const SkRect& r, const SkMatrix& matrix) {
+    SkString url(static_cast<const char *>(urlData->data()),
+                 urlData->size() - 1);
     SkMatrix transform = matrix;
     transform.postConcat(fInitialTransform);
     SkRect translatedRect;
@@ -1336,18 +1307,18 @@ SkPDFDict* SkPDFDevice::createLinkAnnotation(const SkRect& r, const SkMatrix& ma
     if (NULL == fAnnotations) {
         fAnnotations = SkNEW(SkPDFArray);
     }
-    SkPDFDict* annotation(SkNEW_ARGS(SkPDFDict, ("Annot")));
+    SkAutoTUnref<SkPDFDict> annotation(new SkPDFDict("Annot"));
     annotation->insertName("Subtype", "Link");
-    fAnnotations->append(annotation);
+    fAnnotations->append(annotation.get());
 
-    SkAutoTUnref<SkPDFArray> border(SkNEW(SkPDFArray));
+    SkAutoTUnref<SkPDFArray> border(new SkPDFArray);
     border->reserve(3);
     border->appendInt(0);  // Horizontal corner radius.
     border->appendInt(0);  // Vertical corner radius.
     border->appendInt(0);  // Width, 0 = no border.
     annotation->insert("Border", border.get());
 
-    SkAutoTUnref<SkPDFArray> rect(SkNEW(SkPDFArray));
+    SkAutoTUnref<SkPDFArray> rect(new SkPDFArray);
     rect->reserve(4);
     rect->appendScalar(translatedRect.fLeft);
     rect->appendScalar(translatedRect.fTop);
@@ -1355,66 +1326,12 @@ SkPDFDict* SkPDFDevice::createLinkAnnotation(const SkRect& r, const SkMatrix& ma
     rect->appendScalar(translatedRect.fBottom);
     annotation->insert("Rect", rect.get());
 
-    return annotation;
-}
-
-void SkPDFDevice::handleLinkToURL(SkData* urlData, const SkRect& r,
-                                  const SkMatrix& matrix) {
-    SkAutoTUnref<SkPDFDict> annotation(createLinkAnnotation(r, matrix));
-
-    SkString url(static_cast<const char *>(urlData->data()),
-                 urlData->size() - 1);
-    SkAutoTUnref<SkPDFDict> action(SkNEW_ARGS(SkPDFDict, ("Action")));
+    SkAutoTUnref<SkPDFDict> action(new SkPDFDict("Action"));
     action->insertName("S", "URI");
-    action->insert("URI", SkNEW_ARGS(SkPDFString, (url)))->unref();
+    action->insert("URI", new SkPDFString(url))->unref();
     annotation->insert("A", action.get());
-}
-
-void SkPDFDevice::handleLinkToNamedDest(SkData* nameData, const SkRect& r,
-                                        const SkMatrix& matrix) {
-    SkAutoTUnref<SkPDFDict> annotation(createLinkAnnotation(r, matrix));
-    SkString name(static_cast<const char *>(nameData->data()),
-                  nameData->size() - 1);
-    annotation->insert("Dest", SkNEW_ARGS(SkPDFString, (name)))->unref();
-}
-
-struct NamedDestination {
-    const SkData* nameData;
-    SkPoint point;
 
-    NamedDestination(const SkData* nameData, const SkPoint& point)
-        : nameData(nameData), point(point) {
-        nameData->ref();
-    }
-
-    ~NamedDestination() {
-        nameData->unref();
-    }
-};
-
-void SkPDFDevice::defineNamedDestination(SkData* nameData, const SkPoint& point,
-                                         const SkMatrix& matrix) {
-    SkMatrix transform = matrix;
-    transform.postConcat(fInitialTransform);
-    SkPoint translatedPoint;
-    transform.mapXY(point.x(), point.y(), &translatedPoint);
-    fNamedDestinations.push(
-        SkNEW_ARGS(NamedDestination, (nameData, translatedPoint)));
-}
-
-void SkPDFDevice::appendDestinations(SkPDFDict* dict, SkPDFObject* page) {
-    int nDest = fNamedDestinations.count();
-    for (int i = 0; i < nDest; i++) {
-        NamedDestination* dest = fNamedDestinations[i];
-        SkAutoTUnref<SkPDFArray> pdfDest(SkNEW(SkPDFArray));
-        pdfDest->reserve(5);
-        pdfDest->append(SkNEW_ARGS(SkPDFObjRef, (page)))->unref();
-        pdfDest->appendName("XYZ");
-        pdfDest->appendInt(dest->point.x());
-        pdfDest->appendInt(dest->point.y());
-        pdfDest->appendInt(0);  // Leave zoom unchanged
-        dict->insert(static_cast<const char *>(dest->nameData->data()), pdfDest);
-    }
+    return p.isNoDrawAnnotation();
 }
 
 SkPDFFormXObject* SkPDFDevice::createFormXObjectFromDevice() {
index 7ee27783262d160c33cf99909ca1ff016846a592..4c66c6bb90a0342e40fca33bb4c2dff9c1fbe7e1 100644 (file)
@@ -107,25 +107,18 @@ bool SkPDFDocument::emitPDF(SkWStream* stream) {
         fDocCatalog->insert("OutputIntent", intentArray.get());
         */
 
-        SkPDFDict* dests = SkNEW(SkPDFDict);  // fPageResources owns reference
-        fCatalog->addObject(dests, true /* onFirstPage */);
-        fPageResources.push(dests);
-
         bool firstPage = true;
         for (int i = 0; i < fPages.count(); i++) {
             int resourceCount = fPageResources.count();
             fPages[i]->finalizePage(fCatalog.get(), firstPage, &fPageResources);
             addResourcesToCatalog(resourceCount, firstPage, &fPageResources,
                                   fCatalog.get());
-            fPages[i]->appendDestinations(dests);
             if (i == 0) {
                 firstPage = false;
                 fSecondPageFirstResourceIndex = fPageResources.count();
             }
         }
 
-        fDocCatalog->insert("Dests", SkNEW_ARGS(SkPDFObjRef, (dests)))->unref();
-
         // Build font subsetting info before proceeding.
         perform_font_subsetting(fCatalog.get(), fPages, &fSubstitutes);
 
index 4cdc00003b617cbbff0f8e40448052b8b3e5a232..f47f8ffd46a6d7f1cae7129db80ee0e67adda8b1 100644 (file)
@@ -147,7 +147,3 @@ const SkTDArray<SkPDFFont*>& SkPDFPage::getFontResources() const {
 const SkPDFGlyphSetMap& SkPDFPage::getFontGlyphUsage() const {
     return fDevice->getFontGlyphUsage();
 }
-
-void SkPDFPage::appendDestinations(SkPDFDict* dict) {
-    fDevice->appendDestinations(dict, this);
-}
index 285a2f565ef3798b560635b1f59e115cbe3253ad..72ba335e66c5bf828cdfd7a66c08d3ba22a32c70 100644 (file)
@@ -48,11 +48,6 @@ public:
     void finalizePage(SkPDFCatalog* catalog, bool firstPage,
                       SkTDArray<SkPDFObject*>* resourceObjects);
 
-    /** Add destinations for this page to the supplied dictionary.
-     *  @param dict       Dictionary to add destinations to.
-     */
-    void appendDestinations(SkPDFDict* dict);
-
     /** Determine the size of the page content and store to the catalog
      *  the offsets of all nonresource-indirect objects that make up the page
      *  content.  This must be called before emitPage(), but after finalizePage.
index f5f98f2bdf7ab6ee0b58d5ad3f6c9cf4b6cd6dd6..b563652cb90256f52e79a2b12aa3c6ed7f4afbdd 100644 (file)
@@ -25,9 +25,8 @@ enum PaintFlats {
     kShader_PaintFlat,
     kImageFilter_PaintFlat,
     kXfermode_PaintFlat,
-    kAnnotation_PaintFlat,
 
-    kLast_PaintFlat = kAnnotation_PaintFlat
+    kLast_PaintFlat = kXfermode_PaintFlat
 };
 #define kCount_PaintFlats   (kLast_PaintFlat + 1)
 
index f47f3bfe657875d8fb8d16ada4294f06c3cf7162..6cffb1b34319252b823afe742e78dfa886f08691 100644 (file)
@@ -53,9 +53,6 @@ static void set_paintflat(SkPaint* paint, SkFlattenable* obj, unsigned paintFlat
         case kXfermode_PaintFlat:
             paint->setXfermode((SkXfermode*)obj);
             break;
-        case kAnnotation_PaintFlat:
-            paint->setAnnotation((SkAnnotation*)obj);
-            break;
         default:
             SkDEBUGFAIL("never gets here");
     }
index 34020dfe7f82984d04b4ffea35637af59efbc990..cfd1e7ceef5526c2332392b5173f14b71250a18e 100644 (file)
@@ -6,7 +6,6 @@
  * found in the LICENSE file.
  */
 
-#include "SkAnnotation.h"
 #include "SkBitmapHeap.h"
 #include "SkCanvas.h"
 #include "SkColorFilter.h"
@@ -48,7 +47,6 @@ static SkFlattenable* get_paintflat(const SkPaint& paint, unsigned paintFlat) {
         case kShader_PaintFlat:         return paint.getShader();
         case kImageFilter_PaintFlat:    return paint.getImageFilter();
         case kXfermode_PaintFlat:       return paint.getXfermode();
-        case kAnnotation_PaintFlat:     return paint.getAnnotation();
     }
     SkDEBUGFAIL("never gets here");
     return NULL;
index 2d35cefc7dd3c78fb54dc02c2f6a2698ea2ea572..26a61ca3947b14385152f0e6fe87017c669752c9 100644 (file)
@@ -15,7 +15,6 @@
 
 #include "Sk1DPathEffect.h"
 #include "Sk2DPathEffect.h"
-#include "SkAnnotation.h"
 #include "SkAvoidXfermode.h"
 #include "SkBicubicImageFilter.h"
 #include "SkBitmapSource.h"
@@ -31,8 +30,6 @@
 #include "SkComposeShader.h"
 #include "SkCornerPathEffect.h"
 #include "SkDashPathEffect.h"
-#include "SkData.h"
-#include "SkDataSet.h"
 #include "SkDiscretePathEffect.h"
 #include "SkDisplacementMapEffect.h"
 #include "SkEmptyShader.h"
@@ -55,7 +52,6 @@
 
 void SkFlattenable::InitializeFlattenables() {
 
-    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkAnnotation)
     SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkAvoidXfermode)
     SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBicubicImageFilter)
     SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapProcShader)
@@ -70,8 +66,6 @@ void SkFlattenable::InitializeFlattenables() {
     SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposeShader)
     SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkCornerPathEffect)
     SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDashPathEffect)
-    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkData)
-    SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDataSet)
     SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDilateImageFilter)
     SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiscretePathEffect)
     SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDisplacementMapEffect)
index 5429b58912672cbb847261a1cc02692936285685..586525a9e8a0a97e5e5c923e2b72d4a5c03fdaf0 100644 (file)
 #include "SkPDFDevice.h"
 #include "SkPDFDocument.h"
 
-/** Returns true if data (may contain null characters) contains needle (null
- *  terminated). */
-static bool ContainsString(const char* data, size_t dataSize, const char* needle) {
-    size_t nSize = strlen(needle);
-    for (size_t i = 0; i < dataSize - nSize; i++) {
-        if (strncmp(&data[i], needle, nSize) == 0) {
-            return true;
-        }
-    }
-    return false;
-}
-
 static void test_nodraw(skiatest::Reporter* reporter) {
     SkBitmap bm;
     bm.setConfig(SkBitmap::kARGB_8888_Config, 10, 10);
@@ -67,38 +55,27 @@ static void test_pdf_link_annotations(skiatest::Reporter* reporter) {
         SkAutoDataUnref out(outStream.copyToData());
         const char* rawOutput = (const char*)out->data();
 
-        REPORTER_ASSERT(reporter,
-            ContainsString(rawOutput, out->size(), "/Annots ")
-            == tests[testNum].expectAnnotations);
+        bool found = false;
+        for (size_t i = 0; i < out->size() - 8; i++) {
+            if (rawOutput[i + 0] == '/' &&
+                rawOutput[i + 1] == 'A' &&
+                rawOutput[i + 2] == 'n' &&
+                rawOutput[i + 3] == 'n' &&
+                rawOutput[i + 4] == 'o' &&
+                rawOutput[i + 5] == 't' &&
+                rawOutput[i + 6] == 's' &&
+                rawOutput[i + 7] == ' ') {
+                found = true;
+                break;
+            }
+        }
+        REPORTER_ASSERT(reporter, found == tests[testNum].expectAnnotations);
     }
 }
 
-static void test_named_destination_annotations(skiatest::Reporter* reporter) {
-    SkISize size = SkISize::Make(612, 792);
-    SkMatrix initialTransform;
-    initialTransform.reset();
-    SkPDFDevice device(size, size, initialTransform);
-    SkCanvas canvas(&device);
-
-    SkPoint p = SkPoint::Make(SkIntToScalar(72), SkIntToScalar(72));
-    SkAutoDataUnref data(SkData::NewWithCString("example"));
-    SkAnnotateNamedDestination(&canvas, p, data.get());
-
-    SkPDFDocument doc;
-    doc.appendPage(&device);
-    SkDynamicMemoryWStream outStream;
-    doc.emitPDF(&outStream);
-    SkAutoDataUnref out(outStream.copyToData());
-    const char* rawOutput = (const char*)out->data();
-
-    REPORTER_ASSERT(reporter,
-        ContainsString(rawOutput, out->size(), "/example "));
-}
-
 static void TestAnnotation(skiatest::Reporter* reporter) {
     test_nodraw(reporter);
     test_pdf_link_annotations(reporter);
-    test_named_destination_annotations(reporter);
 }
 
 #include "TestClassDef.h"