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 @@ ...@@ -24,6 +24,7 @@
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_iterator.h" #include "content/public/browser/render_widget_host_iterator.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
using content::RenderProcessHost; using content::RenderProcessHost;
using content::RenderProcessHostImpl; using content::RenderProcessHostImpl;
...@@ -111,13 +112,14 @@ SkColor NSColorToSkColor(NSColor* color) { ...@@ -111,13 +112,14 @@ SkColor NSColorToSkColor(NSColor* color) {
bytesPerRow:4 bytesPerRow:4
bitsPerPixel:32]); bitsPerPixel:32]);
[NSGraphicsContext saveGraphicsState]; {
[NSGraphicsContext gfx::ScopedNSGraphicsContextSaveGState gstate;
setCurrentContext:[NSGraphicsContext [NSGraphicsContext
graphicsContextWithBitmapImageRep:offscreen_rep]]; setCurrentContext:[NSGraphicsContext
NSEraseRect(NSMakeRect(0, 0, 1, 1)); graphicsContextWithBitmapImageRep:offscreen_rep]];
[color drawSwatchInRect:NSMakeRect(0, 0, 1, 1)]; [color set];
[NSGraphicsContext restoreGraphicsState]; NSRectFill(NSMakeRect(0, 0, 1, 1));
}
NSUInteger pixel[4]; NSUInteger pixel[4];
[offscreen_rep getPixel:pixel atX:0 y:0]; [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