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

Unified Diff: content/renderer/render_widget.cc

Issue 10534099: Delete code used to invert web content for high-contrast mode. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added back include that's needed by other code Created 8 years, 6 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 | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 64cd94a6300db7bc6ed3318f655a05b2cc695d17..8514eedca33e039e26a72e6ea7b8846b1c451e55 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -33,7 +33,6 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
#include "third_party/skia/include/core/SkShader.h"
-#include "third_party/skia/include/effects/SkTableColorFilter.h"
#include "ui/gfx/point.h"
#include "ui/gfx/size.h"
#include "ui/gfx/skia_util.h"
@@ -107,8 +106,7 @@ RenderWidget::RenderWidget(WebKit::WebPopupType popup_type,
animation_update_pending_(false),
invalidation_task_posted_(false),
screen_info_(screen_info),
- device_scale_factor_(1),
- invert_(false) {
+ device_scale_factor_(1) {
if (!swapped_out)
RenderProcess::current()->AddRefProcess();
DCHECK(RenderThread::Get());
@@ -239,7 +237,6 @@ bool RenderWidget::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnMsgRepaint)
IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection)
IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck)
- IPC_MESSAGE_HANDLER(ViewMsg_InvertWebContent, OnInvertWebContent)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -631,15 +628,6 @@ void RenderWidget::PaintRect(const gfx::Rect& rect,
canvas->translate(static_cast<SkScalar>(-canvas_origin.x()),
static_cast<SkScalar>(-canvas_origin.y()));
- if (invert_) {
- // Draw everything to a temporary bitmap and then apply an
- // inverting color map to the result. This is balanced by an extra
- // call to canvas->restore(), below.
- DCHECK(invert_paint_.get());
- SkRect bounds(gfx::RectToSkRect(rect));
- canvas->saveLayer(&bounds, invert_paint_.get());
- }
-
// If there is a custom background, tile it.
if (!background_.empty()) {
SkPaint paint;
@@ -697,9 +685,6 @@ void RenderWidget::PaintRect(const gfx::Rect& rect,
skia::GetTopDevice(*canvas)->accessBitmap(false);
}
- if (invert_)
- canvas->restore();
-
PaintDebugBorder(rect, canvas);
canvas->restore();
}
@@ -1494,37 +1479,6 @@ void RenderWidget::OnSetTextDirection(WebTextDirection direction) {
webwidget_->setTextDirection(direction);
}
-void RenderWidget::OnInvertWebContent(bool invert) {
- if (invert_ == invert)
- return;
-
- invert_ = invert;
-
- if (invert_ && !invert_paint_.get()) {
- // Gamma-aware color inversion: each source pixel value x is normally
- // displayed on a computer monitor with a gamma correction x^gamma,
- // where gamma is typically in the range 1.8...2.2. By approximating
- // gamma as exactly 2, the formula to invert one value is sqrt(1 - x^2).
- uint8_t table[256];
- for (unsigned int i = 0; i < 256; i++) {
- double value = i / 255.0;
- value = sqrt(1 - (value * value));
- table[i] = static_cast<uint8_t>(255 * value);
- }
-
- // Create a Skia Paint with this inverting color map.
- invert_paint_.reset(new SkPaint());
- invert_paint_->setStyle(SkPaint::kFill_Style);
- invert_paint_->setColor(SK_ColorBLACK);
- SkColorFilter* filter = SkTableColorFilter::CreateARGB(
- NULL, table, table, table);
- invert_paint_->setColorFilter(filter);
- filter->unref();
- }
-
- OnMsgRepaint(size_);
-}
-
webkit::ppapi::PluginInstance* RenderWidget::GetBitmapForOptimizedPluginPaint(
const gfx::Rect& paint_bounds,
TransportDIB** dib,
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698