Commit c6471378 authored by Robert Sesek's avatar Robert Sesek Committed by Commit Bot

[Mac] Use NSRectFill in content::NSColorToSkColor().

Previously it used -[NSColor drawSwatchInRect:] which "adorns" the color
with additional drawing.

Bug: 641509, 36032
Change-Id: Ib3dd089980c4d942b0aac0435a94f5ad44fcd3e4
Reviewed-on: https://chromium-review.googlesource.com/c/1343045
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609759}
parent c60b7aa8
......@@ -24,6 +24,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_iterator.h"
#include "content/public/common/content_switches.h"
#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
using content::RenderProcessHost;
using content::RenderProcessHostImpl;
......@@ -111,13 +112,14 @@ SkColor NSColorToSkColor(NSColor* color) {
bytesPerRow:4
bitsPerPixel:32]);
[NSGraphicsContext saveGraphicsState];
{
gfx::ScopedNSGraphicsContextSaveGState gstate;
[NSGraphicsContext
setCurrentContext:[NSGraphicsContext
graphicsContextWithBitmapImageRep:offscreen_rep]];
NSEraseRect(NSMakeRect(0, 0, 1, 1));
[color drawSwatchInRect:NSMakeRect(0, 0, 1, 1)];
[NSGraphicsContext restoreGraphicsState];
[color set];
NSRectFill(NSMakeRect(0, 0, 1, 1));
}
NSUInteger pixel[4];
[offscreen_rep getPixel:pixel atX:0 y:0];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment