| Index: trunk/src/ui/gfx/image/image.cc
|
| ===================================================================
|
| --- trunk/src/ui/gfx/image/image.cc (revision 224498)
|
| +++ trunk/src/ui/gfx/image/image.cc (working copy)
|
| @@ -43,7 +43,7 @@
|
| CHECK(pixbuf);
|
| gfx::Canvas canvas(gfx::Size(gdk_pixbuf_get_width(pixbuf),
|
| gdk_pixbuf_get_height(pixbuf)),
|
| - 1.0f,
|
| + ui::SCALE_FACTOR_100P,
|
| false);
|
| skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas());
|
| cairo_t* cr = scoped_platform_paint.GetPlatformSurface();
|
| @@ -65,7 +65,7 @@
|
| const std::vector<gfx::ImagePNGRep>& image_png_reps) {
|
| scoped_refptr<base::RefCountedMemory> png_bytes(NULL);
|
| for (size_t i = 0; i < image_png_reps.size(); ++i) {
|
| - if (image_png_reps[i].scale == 1.0f)
|
| + if (image_png_reps[i].scale_factor == ui::SCALE_FACTOR_100P)
|
| png_bytes = image_png_reps[i].raw_data;
|
| }
|
|
|
| @@ -142,7 +142,7 @@
|
| bitmap.setConfig(SkBitmap::kARGB_8888_Config, 16, 16);
|
| bitmap.allocPixels();
|
| bitmap.eraseRGB(0xff, 0, 0);
|
| - return new gfx::ImageSkia(gfx::ImageSkiaRep(bitmap, 1.0f));
|
| + return new gfx::ImageSkia(gfx::ImageSkiaRep(bitmap, ui::SCALE_FACTOR_100P));
|
| }
|
|
|
| ImageSkia* ImageSkiaFromPNG(
|
| @@ -159,22 +159,23 @@
|
| if (!gfx::PNGCodec::Decode(raw_data->front(), raw_data->size(),
|
| &bitmap)) {
|
| LOG(ERROR) << "Unable to decode PNG for "
|
| - << image_png_reps[i].scale
|
| + << ui::GetScaleFactorScale(image_png_reps[i].scale_factor)
|
| << ".";
|
| return GetErrorImageSkia();
|
| }
|
| image_skia->AddRepresentation(gfx::ImageSkiaRep(
|
| - bitmap, image_png_reps[i].scale));
|
| + bitmap, image_png_reps[i].scale_factor));
|
| }
|
| return image_skia.release();
|
| }
|
|
|
| scoped_refptr<base::RefCountedMemory> Get1xPNGBytesFromImageSkia(
|
| const ImageSkia* image_skia) {
|
| - ImageSkiaRep image_skia_rep = image_skia->GetRepresentation(1.0f);
|
| + ImageSkiaRep image_skia_rep = image_skia->GetRepresentation(
|
| + ui::SCALE_FACTOR_100P);
|
|
|
| scoped_refptr<base::RefCountedBytes> png_bytes(new base::RefCountedBytes());
|
| - if (image_skia_rep.scale() != 1.0f ||
|
| + if (image_skia_rep.scale_factor() != ui::SCALE_FACTOR_100P ||
|
| !gfx::PNGCodec::EncodeBGRASkBitmap(image_skia_rep.sk_bitmap(), false,
|
| &png_bytes->data())) {
|
| return NULL;
|
| @@ -273,7 +274,7 @@
|
| if (!size_cache_) {
|
| for (std::vector<ImagePNGRep>::const_iterator it = image_reps().begin();
|
| it != image_reps().end(); ++it) {
|
| - if (it->scale == 1.0f) {
|
| + if (it->scale_factor == ui::SCALE_FACTOR_100P) {
|
| size_cache_.reset(new gfx::Size(it->Size()));
|
| return *size_cache_;
|
| }
|
| @@ -603,7 +604,7 @@
|
| scoped_refptr<base::RefCountedBytes> raw_data(new base::RefCountedBytes());
|
| raw_data->data().assign(input, input + input_size);
|
| std::vector<gfx::ImagePNGRep> image_reps;
|
| - image_reps.push_back(ImagePNGRep(raw_data, 1.0f));
|
| + image_reps.push_back(ImagePNGRep(raw_data, ui::SCALE_FACTOR_100P));
|
| return gfx::Image(image_reps);
|
| }
|
|
|
| @@ -771,7 +772,7 @@
|
| const std::vector<gfx::ImagePNGRep>& image_png_reps =
|
| rep->AsImageRepPNG()->image_reps();
|
| for (size_t i = 0; i < image_png_reps.size(); ++i) {
|
| - if (image_png_reps[i].scale == 1.0f)
|
| + if (image_png_reps[i].scale_factor == ui::SCALE_FACTOR_100P)
|
| return image_png_reps[i].raw_data;
|
| }
|
| return new base::RefCountedBytes();
|
| @@ -826,7 +827,8 @@
|
| // final type eg (converting from ImageRepSkia to ImageRepPNG to get an
|
| // ImageRepCocoa).
|
| std::vector<ImagePNGRep> image_png_reps;
|
| - image_png_reps.push_back(gfx::ImagePNGRep(png_bytes, 1.0f));
|
| + image_png_reps.push_back(gfx::ImagePNGRep(png_bytes,
|
| + ui::SCALE_FACTOR_100P));
|
| rep = new internal::ImageRepPNG(image_png_reps);
|
| AddRepresentation(rep);
|
| return png_bytes;
|
|
|