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

Unified Diff: ui/gfx/canvas_paint_mac.mm

Issue 854713003: More old files deletion. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix tryjobs? 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 | « ui/gfx/canvas_paint_mac.h ('k') | ui/gfx/canvas_paint_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/canvas_paint_mac.mm
diff --git a/ui/gfx/canvas_paint_mac.mm b/ui/gfx/canvas_paint_mac.mm
deleted file mode 100644
index 8ba697d1091ec3dd6d99fd03fe5d2e7832719c61..0000000000000000000000000000000000000000
--- a/ui/gfx/canvas_paint_mac.mm
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2012 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.
-
-#include "ui/gfx/canvas_paint_mac.h"
-#include "ui/gfx/size.h"
-
-namespace gfx {
-
-CanvasSkiaPaint::CanvasSkiaPaint(NSRect dirtyRect)
- : context_(NULL),
- rectangle_(dirtyRect),
- composite_alpha_(false) {
- Init(true);
-}
-
-CanvasSkiaPaint::CanvasSkiaPaint(NSRect dirtyRect, bool opaque)
- : context_(NULL),
- rectangle_(dirtyRect),
- composite_alpha_(false) {
- Init(opaque);
-}
-
-CanvasSkiaPaint::~CanvasSkiaPaint() {
- if (!is_empty()) {
- platform_canvas()->restoreToCount(1);
-
- // Blit the dirty rect to the current context.
- CGImageRef image = CGBitmapContextCreateImage(context_);
- CGRect dest_rect = NSRectToCGRect(rectangle_);
-
- CGContextRef destination_context =
- (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
- CGContextSaveGState(destination_context);
- CGContextSetBlendMode(
- destination_context,
- composite_alpha_ ? kCGBlendModeNormal : kCGBlendModeCopy);
-
- if ([[NSGraphicsContext currentContext] isFlipped]) {
- // Mirror context on the target's rect middle scanline.
- CGContextTranslateCTM(destination_context, 0.0, NSMidY(rectangle_));
- CGContextScaleCTM(destination_context, 1.0, -1.0);
- CGContextTranslateCTM(destination_context, 0.0, -NSMidY(rectangle_));
- }
-
- CGContextDrawImage(destination_context, dest_rect, image);
- CGContextRestoreGState(destination_context);
-
- CFRelease(image);
- }
-}
-
-void CanvasSkiaPaint::Init(bool opaque) {
- CGContextRef destination_context =
- (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
- CGRect scaled_unit_rect = CGContextConvertRectToDeviceSpace(
- destination_context, CGRectMake(0, 0, 1, 1));
- // Assume that the x scale and the y scale are the same.
- CGFloat scale = scaled_unit_rect.size.width;
-
- gfx::Size size(NSWidth(rectangle_), NSHeight(rectangle_));
- RecreateBackingCanvas(size, scale, opaque);
- skia::PlatformCanvas* canvas = platform_canvas();
- canvas->clear(SkColorSetARGB(0, 0, 0, 0));
-
- // Need to translate so that the dirty region appears at the origin of the
- // surface.
- canvas->translate(-SkDoubleToScalar(NSMinX(rectangle_)),
- -SkDoubleToScalar(NSMinY(rectangle_)));
-
- context_ = skia::GetBitmapContext(skia::GetTopDevice(*canvas));
-}
-
-} // namespace skia
-
-
« no previous file with comments | « ui/gfx/canvas_paint_mac.h ('k') | ui/gfx/canvas_paint_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698