diff options
author | Leon Scroggins <scroggo@google.com> | 2009-08-31 18:49:41 -0400 |
---|---|---|
committer | Leon Scroggins <scroggo@google.com> | 2009-09-01 09:56:36 -0400 |
commit | de617918ccc283c8b5f7ad424732cbcc8597c837 (patch) | |
tree | 3fcd20728a098b8582df5def9abe83eba257b8f9 /WebKit | |
parent | e7f607ca3a06ec0129f0f95a529df91146876fff (diff) | |
download | external_webkit-de617918ccc283c8b5f7ad424732cbcc8597c837.zip external_webkit-de617918ccc283c8b5f7ad424732cbcc8597c837.tar.gz external_webkit-de617918ccc283c8b5f7ad424732cbcc8597c837.tar.bz2 |
Update the browser's references to the latest images.
The browser directly references the names of the asset
files it uses to draw buttons, checkboxes, and radio
buttons. Update the names to correspond to the latest
assets. Fixes issue http://b/issue?id=2086818
Change-Id: Iac8d8762252707e21a88e65ba44de24a5fa2f869
Diffstat (limited to 'WebKit')
-rw-r--r-- | WebKit/android/RenderSkinButton.cpp | 8 | ||||
-rw-r--r-- | WebKit/android/RenderSkinRadio.cpp | 27 |
2 files changed, 21 insertions, 14 deletions
diff --git a/WebKit/android/RenderSkinButton.cpp b/WebKit/android/RenderSkinButton.cpp index 0f792a7..7ab2491 100644 --- a/WebKit/android/RenderSkinButton.cpp +++ b/WebKit/android/RenderSkinButton.cpp @@ -43,10 +43,10 @@ struct PatchData { static const PatchData gFiles[] = { - { "res/drawable/btn_default_normal_disable.9.png", 2, 7 }, - { "res/drawable/btn_default_normal.9.png", 2, 7 }, - { "res/drawable/btn_default_selected.9.png", 2, 7 }, - { "res/drawable/btn_default_pressed.9.png", 2, 7 } + { "res/drawable-mdpi/btn_default_normal_disable.9.png", 2, 7 }, + { "res/drawable-mdpi/btn_default_normal.9.png", 2, 7 }, + { "res/drawable-mdpi/btn_default_selected.9.png", 2, 7 }, + { "res/drawable-mdpi/btn_default_pressed.9.png", 2, 7 } }; static SkBitmap gButton[sizeof(gFiles)/sizeof(gFiles[0])]; diff --git a/WebKit/android/RenderSkinRadio.cpp b/WebKit/android/RenderSkinRadio.cpp index ff5e908..b9b67f5 100644 --- a/WebKit/android/RenderSkinRadio.cpp +++ b/WebKit/android/RenderSkinRadio.cpp @@ -37,9 +37,12 @@ #include "SkCanvas.h" #include "SkRect.h" -static const char* checks[] = { "res/drawable/checkbox_off_background.png", "res/drawable/checkbox_on_background.png", - "res/drawable/radiobutton_off_background.png", "res/drawable/radiobutton_on_background.png"}; -static const SkScalar SIZE = SkIntToScalar(19); // Default height and width - corresponds with the bitmap - perhaps we should query the bitmap. +static const char* checks[] = { "res/drawable-mdpi/btn_check_off.png", + "res/drawable-mdpi/btn_check_on.png", + "res/drawable-mdpi/btn_radio_off.png", + "res/drawable-mdpi/btn_radio_on.png"}; +// Matches the width of the bitmap +static SkScalar SIZE; namespace WebCore { @@ -54,6 +57,7 @@ void RenderSkinRadio::Init(android::AssetManager* am) s_decoded = RenderSkinAndroid::DecodeBitmap(am, checks[1], &s_bitmap[1]) && s_decoded; s_decoded = RenderSkinAndroid::DecodeBitmap(am, checks[2], &s_bitmap[2]) && s_decoded; s_decoded = RenderSkinAndroid::DecodeBitmap(am, checks[3], &s_bitmap[3]) && s_decoded; + SIZE = SkIntToScalar(s_bitmap[0].width()); } void RenderSkinRadio::Draw(SkCanvas* canvas, Node* element, const IntRect& ir, @@ -63,6 +67,9 @@ void RenderSkinRadio::Draw(SkCanvas* canvas, Node* element, const IntRect& ir, return; } SkRect r(ir); + // Set up a paint to with filtering to look better. + SkPaint paint; + paint.setFlags(SkPaint::kFilterBitmap_Flag); int saveLayerCount = 0; int saveScaleCount = 0; @@ -71,23 +78,23 @@ void RenderSkinRadio::Draw(SkCanvas* canvas, Node* element, const IntRect& ir, saveLayerCount = canvas->saveLayerAlpha(&r, 0x80); } SkScalar width = r.width(); - if (SIZE != width) { - SkScalar scale = SkScalarDiv(width, SIZE); - saveScaleCount = canvas->scale(scale, scale); - } + SkScalar scale = SkScalarDiv(width, SIZE); + saveScaleCount = canvas->save(); + canvas->translate(r.fLeft, r.fTop); + canvas->scale(scale, scale); + bool checked = false; if (InputElement* inputElement = toInputElement(static_cast<Element*>(element))) { checked = inputElement->isChecked(); } canvas->drawBitmap(s_bitmap[checked + 2*(!isCheckBox)], - r.fLeft, r.fTop, NULL); + 0, 0, &paint); if (saveLayerCount != 0) { canvas->restoreToCount(saveLayerCount); - } else if (saveScaleCount != 0) { + } else { canvas->restoreToCount(saveScaleCount); } - return; } } //WebCore |