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

Unified Diff: cc/paint/paint_surface.h

Issue 2764633002: cc/paint: Remove cc::PaintSurface. (Closed)
Patch Set: fix for relanding Created 3 years, 9 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
Index: cc/paint/paint_surface.h
diff --git a/cc/paint/paint_surface.h b/cc/paint/paint_surface.h
deleted file mode 100644
index 67013ec9b12c79e75e453dc4e5d9f72f5c5f415e..0000000000000000000000000000000000000000
--- a/cc/paint/paint_surface.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CC_PAINT_PAINT_SURFACE_H_
-#define CC_PAINT_PAINT_SURFACE_H_
-
-#include "base/macros.h"
-#include "base/memory/ptr_util.h"
-#include "base/optional.h"
-#include "cc/paint/paint_export.h"
-#include "cc/paint/skia_paint_canvas.h"
-#include "third_party/skia/include/core/SkSurface.h"
-
-namespace cc {
-
-class CC_PAINT_EXPORT PaintSurface : public SkRefCntBase {
- public:
- explicit PaintSurface(sk_sp<SkSurface> surface);
- ~PaintSurface() override;
-
- // TODO(enne): this interface matches SkSurface for simplicity.
- // However, this should really be changed to make the SkSurface ctor
- // public and have that be the only constructor. This will also
- // clean up a bunch of code where there's an SkSurface and a PaintCanvas,
- // such as for canvas in Blink.
- static sk_sp<PaintSurface> MakeRaster(const SkImageInfo& info,
- const SkSurfaceProps* props = nullptr) {
- sk_sp<SkSurface> s = SkSurface::MakeRaster(info, props);
- return sk_make_sp<PaintSurface>(std::move(s));
- }
- static sk_sp<PaintSurface> MakeRasterN32Premul(
- int width,
- int height,
- const SkSurfaceProps* props = nullptr) {
- sk_sp<SkSurface> s = SkSurface::MakeRasterN32Premul(width, height, props);
- return sk_make_sp<PaintSurface>(std::move(s));
- }
-
- int width() const { return surface_->width(); }
- int height() const { return surface_->height(); }
-
- PaintCanvas* getCanvas() {
- if (!canvas_.has_value())
- canvas_.emplace(surface_->getCanvas());
- return &canvas_.value();
- }
-
- private:
- const sk_sp<SkSurface> surface_;
- base::Optional<SkiaPaintCanvas> canvas_;
-
- DISALLOW_COPY_AND_ASSIGN(PaintSurface);
-};
-
-} // namespace cc
-
-#endif // CC_PAINT_PAINT_SURFACE_H_

Powered by Google App Engine
This is Rietveld 408576698