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

Unified Diff: dm/DMSrcSink.h

Issue 853883004: Revert of Sketch DM refactor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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 | « dm/DMSerializeTask.cpp ('k') | dm/DMSrcSink.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSrcSink.h
diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h
deleted file mode 100644
index 3f88f6350b8d48c3b6e3b5b5c0cf54bccee88f65..0000000000000000000000000000000000000000
--- a/dm/DMSrcSink.h
+++ /dev/null
@@ -1,177 +0,0 @@
-#ifndef DMSrcSink_DEFINED
-#define DMSrcSink_DEFINED
-
-#include "DMGpuSupport.h"
-#include "SkBBHFactory.h"
-#include "SkBBoxHierarchy.h"
-#include "SkBitmap.h"
-#include "SkCanvas.h"
-#include "SkData.h"
-#include "SkGPipe.h"
-#include "SkPicture.h"
-#include "SkStream.h"
-#include "gm.h"
-
-namespace DM {
-
-// This is just convenience. It lets you use either return "foo" or return SkStringPrintf(...).
-struct ImplicitString : public SkString {
- template <typename T>
- ImplicitString(const T& s) : SkString(s) {}
-};
-typedef ImplicitString Error;
-typedef ImplicitString Name;
-
-struct Src {
- // All Srcs must be thread safe.
- virtual ~Src() {}
- virtual Error SK_WARN_UNUSED_RESULT draw(SkCanvas*) const = 0;
- virtual SkISize size() const = 0;
- virtual Name name() const = 0;
-};
-
-struct Sink {
- virtual ~Sink() {}
- // You may write to either the bitmap or stream.
- virtual Error SK_WARN_UNUSED_RESULT draw(const Src&, SkBitmap*, SkWStream*) const
- = 0;
- // Sinks in the same enclave (except kAnyThread_Enclave) will run serially on the same thread.
- virtual int enclave() const = 0;
-
- // File extension for the content draw() outputs, e.g. "png", "pdf".
- virtual const char* fileExtension() const = 0;
-};
-
-enum { kAnyThread_Enclave, kGPUSink_Enclave, kPDFSink_Enclave };
-static const int kNumEnclaves = kPDFSink_Enclave + 1;
-
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-void SafeUnref(SkPicture*); // These need external linkage (and specific types).
-void SafeUnref(SkData*);
-
-class GMSrc : public Src {
-public:
- explicit GMSrc(skiagm::GMRegistry::Factory);
-
- Error draw(SkCanvas*) const SK_OVERRIDE;
- SkISize size() const SK_OVERRIDE;
- Name name() const SK_OVERRIDE;
-private:
- skiagm::GMRegistry::Factory fFactory;
-};
-
-class ImageSrc : public Src {
-public:
- explicit ImageSrc(SkString path, int subsets = 0);
-
- Error draw(SkCanvas*) const SK_OVERRIDE;
- SkISize size() const SK_OVERRIDE;
- Name name() const SK_OVERRIDE;
-private:
- SkString fPath;
- int fSubsets;
- SkLazyPtr<SkData, SafeUnref> fEncoded;
-};
-
-class SKPSrc : public Src {
-public:
- explicit SKPSrc(SkString path);
-
- Error draw(SkCanvas*) const SK_OVERRIDE;
- SkISize size() const SK_OVERRIDE;
- Name name() const SK_OVERRIDE;
-private:
- SkString fPath;
- SkLazyPtr<SkPicture, SafeUnref> fPic;
-};
-
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-class GPUSink : public Sink {
-public:
- GPUSink(GrContextFactory::GLContextType, GrGLStandard, int samples, bool dfText);
-
- Error draw(const Src&, SkBitmap*, SkWStream*) const SK_OVERRIDE;
- int enclave() const SK_OVERRIDE;
- const char* fileExtension() const SK_OVERRIDE { return "png"; }
-private:
- GrContextFactory::GLContextType fContextType;
- GrGLStandard fGpuAPI;
- int fSampleCount;
- bool fUseDFText;
-};
-
-class PDFSink : public Sink {
-public:
- PDFSink();
-
- Error draw(const Src&, SkBitmap*, SkWStream*) const SK_OVERRIDE;
- int enclave() const SK_OVERRIDE { return kPDFSink_Enclave; }
- const char* fileExtension() const SK_OVERRIDE { return "pdf"; }
-};
-
-class RasterSink : public Sink {
-public:
- explicit RasterSink(SkColorType);
-
- Error draw(const Src&, SkBitmap*, SkWStream*) const SK_OVERRIDE;
- int enclave() const SK_OVERRIDE { return kAnyThread_Enclave; }
- const char* fileExtension() const SK_OVERRIDE { return "png"; }
-private:
- SkColorType fColorType;
-};
-
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-class ViaMatrix : public Sink {
-public:
- ViaMatrix(SkMatrix, Sink*);
-
- Error draw(const Src&, SkBitmap*, SkWStream*) const SK_OVERRIDE;
- int enclave() const SK_OVERRIDE { return fSink->enclave(); }
- const char* fileExtension() const SK_OVERRIDE { return fSink->fileExtension(); }
-private:
- SkMatrix fMatrix;
- SkAutoTDelete<Sink> fSink;
-};
-
-class ViaPipe : public Sink {
-public:
- ViaPipe(int flags, Sink*);
-
- Error draw(const Src&, SkBitmap*, SkWStream*) const SK_OVERRIDE;
- int enclave() const SK_OVERRIDE { return fSink->enclave(); }
- const char* fileExtension() const SK_OVERRIDE { return fSink->fileExtension(); }
-private:
- SkGPipeWriter::Flags fFlags;
- SkAutoTDelete<Sink> fSink;
-};
-
-class ViaSerialization : public Sink {
-public:
- explicit ViaSerialization(Sink*);
-
- Error draw(const Src&, SkBitmap*, SkWStream*) const SK_OVERRIDE;
- int enclave() const SK_OVERRIDE { return fSink->enclave(); }
- const char* fileExtension() const SK_OVERRIDE { return fSink->fileExtension(); }
-private:
- SkAutoTDelete<Sink> fSink;
-};
-
-class ViaTiles : public Sink {
-public:
- ViaTiles(int w, int h, SkBBHFactory*, Sink*);
-
- Error draw(const Src&, SkBitmap*, SkWStream*) const SK_OVERRIDE;
- int enclave() const SK_OVERRIDE { return fSink->enclave(); }
- const char* fileExtension() const SK_OVERRIDE { return fSink->fileExtension(); }
-private:
- const int fW, fH;
- SkAutoTDelete<SkBBHFactory> fFactory;
- SkAutoTDelete<Sink> fSink;
-};
-
-} // namespace DM
-
-#endif//DMSrcSink_DEFINED
« no previous file with comments | « dm/DMSerializeTask.cpp ('k') | dm/DMSrcSink.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698