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

Side by Side Diff: cc/playback/raster_source.cc

Issue 2179003003: cc: disable denorm handling before calling into Skia's filter code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add the "flush to zero" flag as well. Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/playback/raster_source.h" 5 #include "cc/playback/raster_source.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #ifdef __SSE__
9 #include <xmmintrin.h>
10 #endif
8 11
9 #include "base/trace_event/trace_event.h" 12 #include "base/trace_event/trace_event.h"
10 #include "cc/base/region.h" 13 #include "cc/base/region.h"
11 #include "cc/debug/debug_colors.h" 14 #include "cc/debug/debug_colors.h"
12 #include "cc/playback/display_item_list.h" 15 #include "cc/playback/display_item_list.h"
13 #include "cc/playback/image_hijack_canvas.h" 16 #include "cc/playback/image_hijack_canvas.h"
14 #include "cc/playback/skip_image_canvas.h" 17 #include "cc/playback/skip_image_canvas.h"
15 #include "skia/ext/analysis_canvas.h" 18 #include "skia/ext/analysis_canvas.h"
16 #include "third_party/skia/include/core/SkCanvas.h" 19 #include "third_party/skia/include/core/SkCanvas.h"
17 #include "third_party/skia/include/core/SkClipStack.h" 20 #include "third_party/skia/include/core/SkClipStack.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 69
67 void RasterSource::PlaybackToCanvas(SkCanvas* raster_canvas, 70 void RasterSource::PlaybackToCanvas(SkCanvas* raster_canvas,
68 const gfx::Rect& canvas_bitmap_rect, 71 const gfx::Rect& canvas_bitmap_rect,
69 const gfx::Rect& canvas_playback_rect, 72 const gfx::Rect& canvas_playback_rect,
70 float contents_scale, 73 float contents_scale,
71 const PlaybackSettings& settings) const { 74 const PlaybackSettings& settings) const {
72 SkIRect raster_bounds = gfx::RectToSkIRect(canvas_bitmap_rect); 75 SkIRect raster_bounds = gfx::RectToSkIRect(canvas_bitmap_rect);
73 if (!canvas_playback_rect.IsEmpty() && 76 if (!canvas_playback_rect.IsEmpty() &&
74 !raster_bounds.intersect(gfx::RectToSkIRect(canvas_playback_rect))) 77 !raster_bounds.intersect(gfx::RectToSkIRect(canvas_playback_rect)))
75 return; 78 return;
79 #ifdef __SSE__
80 // Turn on "subnormals are zero" and "flush to zero" CSR flags for
81 // performance.
82 unsigned int csr = _mm_getcsr();
83 _mm_setcsr(csr | 0x8040);
84 #endif
piman 2016/07/25 20:28:40 This may be needed in more places - e.g. software
76 85
77 raster_canvas->save(); 86 raster_canvas->save();
78 raster_canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y()); 87 raster_canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y());
79 raster_canvas->clipRect(SkRect::MakeFromIRect(raster_bounds)); 88 raster_canvas->clipRect(SkRect::MakeFromIRect(raster_bounds));
80 raster_canvas->scale(contents_scale, contents_scale); 89 raster_canvas->scale(contents_scale, contents_scale);
81 PlaybackToCanvas(raster_canvas, settings); 90 PlaybackToCanvas(raster_canvas, settings);
82 raster_canvas->restore(); 91 raster_canvas->restore();
92 #ifdef __SSE__
93 _mm_setcsr(csr);
94 #endif
83 } 95 }
84 96
85 void RasterSource::PlaybackToCanvas(SkCanvas* raster_canvas, 97 void RasterSource::PlaybackToCanvas(SkCanvas* raster_canvas,
86 const PlaybackSettings& settings) const { 98 const PlaybackSettings& settings) const {
87 if (!settings.playback_to_shared_canvas) 99 if (!settings.playback_to_shared_canvas)
88 PrepareForPlaybackToCanvas(raster_canvas); 100 PrepareForPlaybackToCanvas(raster_canvas);
89 101
90 if (settings.skip_images) { 102 if (settings.skip_images) {
91 SkipImageCanvas canvas(raster_canvas); 103 SkipImageCanvas canvas(raster_canvas);
92 RasterCommon(&canvas, nullptr); 104 RasterCommon(&canvas, nullptr);
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 bool can_use_lcd_text = false; 307 bool can_use_lcd_text = false;
296 return scoped_refptr<RasterSource>(new RasterSource(this, can_use_lcd_text)); 308 return scoped_refptr<RasterSource>(new RasterSource(this, can_use_lcd_text));
297 } 309 }
298 310
299 RasterSource::PlaybackSettings::PlaybackSettings() 311 RasterSource::PlaybackSettings::PlaybackSettings()
300 : playback_to_shared_canvas(false), 312 : playback_to_shared_canvas(false),
301 skip_images(false), 313 skip_images(false),
302 use_image_hijack_canvas(true) {} 314 use_image_hijack_canvas(true) {}
303 315
304 } // namespace cc 316 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698