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

Unified Diff: src/image/SkSurface.cpp

Issue 583773004: Revert of introduce Props to surface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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 | « src/gpu/SkGpuDevice.cpp ('k') | src/image/SkSurface_Base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkSurface.cpp
diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp
index 2d0ce7062fc0445bdd86820f57d2a243a55e1a35..3a28e421a880df9ff6ae9962aa504c6bd63bb040 100644
--- a/src/image/SkSurface.cpp
+++ b/src/image/SkSurface.cpp
@@ -9,56 +9,14 @@
#include "SkImagePriv.h"
#include "SkCanvas.h"
-#include "SkFontLCDConfig.h"
-static SkPixelGeometry compute_default_geometry() {
- SkFontLCDConfig::LCDOrder order = SkFontLCDConfig::GetSubpixelOrder();
- if (SkFontLCDConfig::kNONE_LCDOrder == order) {
- return kUnknown_SkPixelGeometry;
- } else {
- // Bit0 is RGB(0), BGR(1)
- // Bit1 is H(0), V(1)
- const SkPixelGeometry gGeo[] = {
- kRGB_H_SkPixelGeometry,
- kBGR_H_SkPixelGeometry,
- kRGB_V_SkPixelGeometry,
- kBGR_V_SkPixelGeometry,
- };
- int index = 0;
- if (SkFontLCDConfig::kBGR_LCDOrder == order) {
- index |= 1;
- }
- if (SkFontLCDConfig::kVertical_LCDOrientation == SkFontLCDConfig::GetSubpixelOrientation()){
- index |= 2;
- }
- return gGeo[index];
- }
-}
-
-SkSurfaceProps::SkSurfaceProps() : fFlags(0), fPixelGeometry(kUnknown_SkPixelGeometry) {}
-
-SkSurfaceProps::SkSurfaceProps(InitType) : fFlags(0), fPixelGeometry(compute_default_geometry()) {}
-
-SkSurfaceProps::SkSurfaceProps(uint32_t flags, InitType)
- : fFlags(flags)
- , fPixelGeometry(compute_default_geometry())
-{}
-
-SkSurfaceProps::SkSurfaceProps(uint32_t flags, SkPixelGeometry pg)
- : fFlags(flags), fPixelGeometry(pg)
-{}
-
///////////////////////////////////////////////////////////////////////////////
-SkSurface_Base::SkSurface_Base(int width, int height, const SkSurfaceProps* props)
- : INHERITED(width, height, props)
-{
+SkSurface_Base::SkSurface_Base(int width, int height) : INHERITED(width, height) {
fCachedCanvas = NULL;
fCachedImage = NULL;
}
-SkSurface_Base::SkSurface_Base(const SkImageInfo& info, const SkSurfaceProps* props)
- : INHERITED(info, props)
-{
+SkSurface_Base::SkSurface_Base(const SkImageInfo& info) : INHERITED(info) {
fCachedCanvas = NULL;
fCachedImage = NULL;
}
@@ -73,7 +31,8 @@
SkSafeUnref(fCachedCanvas);
}
-void SkSurface_Base::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) {
+void SkSurface_Base::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y,
+ const SkPaint* paint) {
SkImage* image = this->newImageSnapshot();
if (image) {
image->draw(canvas, x, y, paint);
@@ -115,17 +74,13 @@
///////////////////////////////////////////////////////////////////////////////
-SkSurface::SkSurface(int width, int height, const SkSurfaceProps* props)
- : fProps(SkSurfacePropsCopyOrDefault(props)), fWidth(width), fHeight(height)
-{
+SkSurface::SkSurface(int width, int height) : fWidth(width), fHeight(height) {
SkASSERT(fWidth >= 0);
SkASSERT(fHeight >= 0);
fGenerationID = 0;
}
-SkSurface::SkSurface(const SkImageInfo& info, const SkSurfaceProps* props)
- : fProps(SkSurfacePropsCopyOrDefault(props)), fWidth(info.width()), fHeight(info.height())
-{
+SkSurface::SkSurface(const SkImageInfo& info) : fWidth(info.width()), fHeight(info.height()) {
SkASSERT(fWidth >= 0);
SkASSERT(fHeight >= 0);
fGenerationID = 0;
@@ -164,51 +119,3 @@
const void* SkSurface::peekPixels(SkImageInfo* info, size_t* rowBytes) {
return this->getCanvas()->peekPixels(info, rowBytes);
}
-
-//////////////////////////////////////////////////////////////////////////////////////
-#ifdef SK_SUPPORT_LEGACY_TEXTRENDERMODE
-
-static SkSurfaceProps make_props(SkSurface::TextRenderMode trm) {
- uint32_t propsFlags = 0;
- if (SkSurface::kDistanceField_TextRenderMode == trm) {
- propsFlags |= SkSurfaceProps::kUseDistanceFieldFonts_Flag;
- }
- return SkSurfaceProps(propsFlags, SkSurfaceProps::kLegacyFontHost_InitType);
-}
-
-SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget* target, TextRenderMode trm,
- RenderTargetFlags flags) {
- SkSurfaceProps props = make_props(trm);
- return NewRenderTargetDirect(target, &props, flags);
-}
-
-SkSurface* SkSurface::NewRenderTarget(GrContext* gr, const SkImageInfo& info, int sampleCount,
- TextRenderMode trm, RenderTargetFlags flags) {
- SkSurfaceProps props = make_props(trm);
- return NewRenderTarget(gr, info, sampleCount, &props, flags);
-}
-
-SkSurface* SkSurface::NewScratchRenderTarget(GrContext* gr, const SkImageInfo& info, int sampleCount,
- TextRenderMode trm, RenderTargetFlags flags) {
- SkSurfaceProps props = make_props(trm);
- return NewScratchRenderTarget(gr, info, sampleCount, &props, flags);
-}
-
-#endif
-
-#if !SK_SUPPORT_GPU
-
-SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget*, const SkSurfaceProps*) {
- return NULL;
-}
-
-SkSurface* SkSurface::NewRenderTarget(GrContext*, const SkImageInfo&, int, const SkSurfaceProps*) {
- return NULL;
-}
-
-SkSurface* SkSurface::NewScratchRenderTarget(GrContext*, const SkImageInfo&, int sampleCount,
- const SkSurfaceProps*) {
- return NULL;
-}
-
-#endif
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/image/SkSurface_Base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698