Switch to standard integer types in pdf/.
BUG=138542 TBR=jam@chromium.org Review URL: https://codereview.chromium.org/1533413002 Cr-Commit-Position: refs/heads/master@{#366446}
This commit is contained in:
pdf
chunk_stream.ccdocument_loader.ccdocument_loader.hdraw_utils.ccdraw_utils.hout_of_process_instance.ccout_of_process_instance.hpaint_aggregator.ccpaint_manager.ccpaint_manager.hpdf.ccpdf_engine.h
pdfium
pdfium_api_string_buffer_adapter.ccpdfium_api_string_buffer_adapter.hpdfium_assert_matching_enums.ccpdfium_engine.ccpdfium_engine.hpdfium_mem_buffer_file_read.ccpdfium_mem_buffer_file_read.hpdfium_mem_buffer_file_write.hpdfium_page.cc
preview_mode_client.ccpreview_mode_client.h@ -4,6 +4,9 @@
|
||||
|
||||
#include "pdf/chunk_stream.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#define __STDC_LIMIT_MACROS
|
||||
#ifdef _WIN32
|
||||
#include <limits.h>
|
||||
@ -13,8 +16,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
|
||||
namespace chrome_pdf {
|
||||
|
||||
ChunkStream::ChunkStream() : stream_size_(0) {
|
||||
|
@ -4,6 +4,9 @@
|
||||
|
||||
#include "pdf/document_loader.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "net/http/http_util.h"
|
||||
|
@ -5,12 +5,14 @@
|
||||
#ifndef PDF_DOCUMENT_LOADER_H_
|
||||
#define PDF_DOCUMENT_LOADER_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "pdf/chunk_stream.h"
|
||||
#include "ppapi/cpp/url_loader.h"
|
||||
#include "ppapi/utility/completion_callback_factory.h"
|
||||
|
@ -4,8 +4,10 @@
|
||||
|
||||
#include "pdf/draw_utils.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include "base/logging.h"
|
||||
@ -13,42 +15,47 @@
|
||||
|
||||
namespace chrome_pdf {
|
||||
|
||||
inline uint8 GetBlue(const uint32& pixel) {
|
||||
return static_cast<uint8>(pixel & 0xFF);
|
||||
inline uint8_t GetBlue(const uint32_t& pixel) {
|
||||
return static_cast<uint8_t>(pixel & 0xFF);
|
||||
}
|
||||
|
||||
inline uint8 GetGreen(const uint32& pixel) {
|
||||
return static_cast<uint8>((pixel >> 8) & 0xFF);
|
||||
inline uint8_t GetGreen(const uint32_t& pixel) {
|
||||
return static_cast<uint8_t>((pixel >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
inline uint8 GetRed(const uint32& pixel) {
|
||||
return static_cast<uint8>((pixel >> 16) & 0xFF);
|
||||
inline uint8_t GetRed(const uint32_t& pixel) {
|
||||
return static_cast<uint8_t>((pixel >> 16) & 0xFF);
|
||||
}
|
||||
|
||||
inline uint8 GetAlpha(const uint32& pixel) {
|
||||
return static_cast<uint8>((pixel >> 24) & 0xFF);
|
||||
inline uint8_t GetAlpha(const uint32_t& pixel) {
|
||||
return static_cast<uint8_t>((pixel >> 24) & 0xFF);
|
||||
}
|
||||
|
||||
inline uint32_t MakePixel(uint8 red, uint8 green, uint8 blue, uint8 alpha) {
|
||||
inline uint32_t MakePixel(uint8_t red,
|
||||
uint8_t green,
|
||||
uint8_t blue,
|
||||
uint8_t alpha) {
|
||||
return (static_cast<uint32_t>(alpha) << 24) |
|
||||
(static_cast<uint32_t>(red) << 16) |
|
||||
(static_cast<uint32_t>(green) << 8) |
|
||||
static_cast<uint32_t>(blue);
|
||||
}
|
||||
|
||||
inline uint8 GradientChannel(uint8 start, uint8 end, double ratio) {
|
||||
inline uint8_t GradientChannel(uint8_t start, uint8_t end, double ratio) {
|
||||
double new_channel = start - (static_cast<double>(start) - end) * ratio;
|
||||
if (new_channel < 0)
|
||||
return 0;
|
||||
if (new_channel > 255)
|
||||
return 255;
|
||||
return static_cast<uint8>(new_channel + 0.5);
|
||||
return static_cast<uint8_t>(new_channel + 0.5);
|
||||
}
|
||||
|
||||
inline uint8 ProcessColor(uint8 src_color, uint8 dest_color, uint8 alpha) {
|
||||
uint32 processed = static_cast<uint32>(src_color) * alpha +
|
||||
static_cast<uint32>(dest_color) * (0xFF - alpha);
|
||||
return static_cast<uint8>((processed / 0xFF) & 0xFF);
|
||||
inline uint8_t ProcessColor(uint8_t src_color,
|
||||
uint8_t dest_color,
|
||||
uint8_t alpha) {
|
||||
uint32_t processed = static_cast<uint32_t>(src_color) * alpha +
|
||||
static_cast<uint32_t>(dest_color) * (0xFF - alpha);
|
||||
return static_cast<uint8_t>((processed / 0xFF) & 0xFF);
|
||||
}
|
||||
|
||||
inline bool ImageDataContainsRect(const pp::ImageData& image_data,
|
||||
@ -57,9 +64,11 @@ inline bool ImageDataContainsRect(const pp::ImageData& image_data,
|
||||
pp::Rect(image_data.size()).Contains(rect);
|
||||
}
|
||||
|
||||
void AlphaBlend(const pp::ImageData& src, const pp::Rect& src_rc,
|
||||
pp::ImageData* dest, const pp::Point& dest_origin,
|
||||
uint8 alpha_adjustment) {
|
||||
void AlphaBlend(const pp::ImageData& src,
|
||||
const pp::Rect& src_rc,
|
||||
pp::ImageData* dest,
|
||||
const pp::Point& dest_origin,
|
||||
uint8_t alpha_adjustment) {
|
||||
if (src_rc.IsEmpty() || !ImageDataContainsRect(src, src_rc))
|
||||
return;
|
||||
|
||||
@ -76,13 +85,15 @@ void AlphaBlend(const pp::ImageData& src, const pp::Rect& src_rc,
|
||||
const uint32_t* src_pixel = src_origin_pixel;
|
||||
uint32_t* dest_pixel = dest_origin_pixel;
|
||||
for (int x = 0; x < width; x++) {
|
||||
uint8 alpha = static_cast<uint8>(static_cast<uint32_t>(alpha_adjustment) *
|
||||
GetAlpha(*src_pixel) / 0xFF);
|
||||
uint8 red = ProcessColor(GetRed(*src_pixel), GetRed(*dest_pixel), alpha);
|
||||
uint8 green = ProcessColor(GetGreen(*src_pixel),
|
||||
GetGreen(*dest_pixel), alpha);
|
||||
uint8 blue = ProcessColor(GetBlue(*src_pixel),
|
||||
GetBlue(*dest_pixel), alpha);
|
||||
uint8_t alpha =
|
||||
static_cast<uint8_t>(static_cast<uint32_t>(alpha_adjustment) *
|
||||
GetAlpha(*src_pixel) / 0xFF);
|
||||
uint8_t red =
|
||||
ProcessColor(GetRed(*src_pixel), GetRed(*dest_pixel), alpha);
|
||||
uint8_t green =
|
||||
ProcessColor(GetGreen(*src_pixel), GetGreen(*dest_pixel), alpha);
|
||||
uint8_t blue =
|
||||
ProcessColor(GetBlue(*src_pixel), GetBlue(*dest_pixel), alpha);
|
||||
*dest_pixel = MakePixel(red, green, blue, GetAlpha(*dest_pixel));
|
||||
|
||||
src_pixel++;
|
||||
@ -95,9 +106,12 @@ void AlphaBlend(const pp::ImageData& src, const pp::Rect& src_rc,
|
||||
}
|
||||
}
|
||||
|
||||
void GradientFill(pp::ImageData* image, const pp::Rect& rc,
|
||||
uint32 start_color, uint32 end_color, bool horizontal) {
|
||||
std::vector<uint32> colors;
|
||||
void GradientFill(pp::ImageData* image,
|
||||
const pp::Rect& rc,
|
||||
uint32_t start_color,
|
||||
uint32_t end_color,
|
||||
bool horizontal) {
|
||||
std::vector<uint32_t> colors;
|
||||
colors.resize(horizontal ? rc.width() : rc.height());
|
||||
for (size_t i = 0; i < colors.size(); ++i) {
|
||||
double ratio = static_cast<double>(i) / colors.size();
|
||||
@ -135,10 +149,10 @@ void GradientFill(pp::Instance* instance,
|
||||
pp::ImageData* image,
|
||||
const pp::Rect& dirty_rc,
|
||||
const pp::Rect& gradient_rc,
|
||||
uint32 start_color,
|
||||
uint32 end_color,
|
||||
uint32_t start_color,
|
||||
uint32_t end_color,
|
||||
bool horizontal,
|
||||
uint8 transparency) {
|
||||
uint8_t transparency) {
|
||||
pp::Rect draw_rc = gradient_rc.Intersect(dirty_rc);
|
||||
if (draw_rc.IsEmpty())
|
||||
return;
|
||||
@ -175,8 +189,8 @@ void CopyImage(const pp::ImageData& src, const pp::Rect& src_rc,
|
||||
for (int32_t y = 0; y < height; ++y) {
|
||||
uint32_t* dest_pixel = dest_origin_pixel;
|
||||
for (int32_t x = 0; x < width; ++x) {
|
||||
uint32 src_x = static_cast<uint32>(x * x_ratio);
|
||||
uint32 src_y = static_cast<uint32>(y * y_ratio);
|
||||
uint32_t src_x = static_cast<uint32_t>(x * x_ratio);
|
||||
uint32_t src_y = static_cast<uint32_t>(y * y_ratio);
|
||||
const uint32_t* src_pixel = src.GetAddr32(
|
||||
pp::Point(src_rc.x() + src_x, src_rc.y() + src_y));
|
||||
*dest_pixel = *src_pixel;
|
||||
@ -199,7 +213,7 @@ void CopyImage(const pp::ImageData& src, const pp::Rect& src_rc,
|
||||
}
|
||||
}
|
||||
|
||||
void FillRect(pp::ImageData* image, const pp::Rect& rc, uint32 color) {
|
||||
void FillRect(pp::ImageData* image, const pp::Rect& rc, uint32_t color) {
|
||||
int height = rc.height();
|
||||
if (height == 0)
|
||||
return;
|
||||
@ -221,7 +235,7 @@ void FillRect(pp::ImageData* image, const pp::Rect& rc, uint32 color) {
|
||||
}
|
||||
}
|
||||
|
||||
ShadowMatrix::ShadowMatrix(uint32 depth, double factor, uint32 background)
|
||||
ShadowMatrix::ShadowMatrix(uint32_t depth, double factor, uint32_t background)
|
||||
: depth_(depth), factor_(factor), background_(background) {
|
||||
DCHECK(depth_ > 0);
|
||||
matrix_.resize(depth_ * depth_);
|
||||
@ -235,10 +249,10 @@ ShadowMatrix::ShadowMatrix(uint32 depth, double factor, uint32 background)
|
||||
double r = static_cast<double>(depth_);
|
||||
double coef = 256.0 / pow(r, factor);
|
||||
|
||||
for (uint32 y = 0; y < depth_; y++) {
|
||||
for (uint32_t y = 0; y < depth_; y++) {
|
||||
// Since matrix is symmetrical, we can reduce the number of calculations
|
||||
// by mirroring results.
|
||||
for (uint32 x = 0; x <= y; x++) {
|
||||
for (uint32_t x = 0; x <= y; x++) {
|
||||
// Fill cache if needed.
|
||||
if (pow_pv[x] == 0.0)
|
||||
pow_pv[x] = pow(x, pv);
|
||||
@ -255,18 +269,18 @@ ShadowMatrix::ShadowMatrix(uint32 depth, double factor, uint32 background)
|
||||
// if factor > 1, smoothing will drop faster near the end (depth).
|
||||
double f = 256.0 - coef * pow(v, factor);
|
||||
|
||||
uint8 alpha = 0;
|
||||
uint8_t alpha = 0;
|
||||
if (f > kOpaqueAlpha)
|
||||
alpha = kOpaqueAlpha;
|
||||
else if (f < kTransparentAlpha)
|
||||
alpha = kTransparentAlpha;
|
||||
else
|
||||
alpha = static_cast<uint8>(f);
|
||||
alpha = static_cast<uint8_t>(f);
|
||||
|
||||
uint8 red = ProcessColor(0, GetRed(background), alpha);
|
||||
uint8 green = ProcessColor(0, GetGreen(background), alpha);
|
||||
uint8 blue = ProcessColor(0, GetBlue(background), alpha);
|
||||
uint32 pixel = MakePixel(red, green, blue, GetAlpha(background));
|
||||
uint8_t red = ProcessColor(0, GetRed(background), alpha);
|
||||
uint8_t green = ProcessColor(0, GetGreen(background), alpha);
|
||||
uint8_t blue = ProcessColor(0, GetBlue(background), alpha);
|
||||
uint32_t pixel = MakePixel(red, green, blue, GetAlpha(background));
|
||||
|
||||
// Mirror matrix.
|
||||
matrix_[y * depth_ + x] = pixel;
|
||||
@ -286,7 +300,7 @@ void PaintShadow(pp::ImageData* image,
|
||||
if (draw_rc.IsEmpty())
|
||||
return;
|
||||
|
||||
int32 depth = static_cast<int32>(matrix.depth());
|
||||
int32_t depth = static_cast<int32_t>(matrix.depth());
|
||||
for (int32_t y = draw_rc.y(); y < draw_rc.bottom(); y++) {
|
||||
for (int32_t x = draw_rc.x(); x < draw_rc.right(); x++) {
|
||||
int32_t matrix_x = std::max(depth + shadow_rc.x() - x - 1,
|
||||
@ -297,12 +311,12 @@ void PaintShadow(pp::ImageData* image,
|
||||
|
||||
if (matrix_x < 0)
|
||||
matrix_x = 0;
|
||||
else if (matrix_x >= static_cast<int32>(depth))
|
||||
else if (matrix_x >= static_cast<int32_t>(depth))
|
||||
matrix_x = depth - 1;
|
||||
|
||||
if (matrix_y < 0)
|
||||
matrix_y = 0;
|
||||
else if (matrix_y >= static_cast<int32>(depth))
|
||||
else if (matrix_y >= static_cast<int32_t>(depth))
|
||||
matrix_y = depth - 1;
|
||||
|
||||
*pixel = matrix.GetValue(matrix_x, matrix_y);
|
||||
|
@ -5,28 +5,31 @@
|
||||
#ifndef PDF_DRAW_UTILS_H_
|
||||
#define PDF_DRAW_UTILS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "ppapi/cpp/image_data.h"
|
||||
#include "ppapi/cpp/rect.h"
|
||||
|
||||
namespace chrome_pdf {
|
||||
|
||||
const uint8 kOpaqueAlpha = 0xFF;
|
||||
const uint8 kTransparentAlpha = 0x00;
|
||||
const uint8_t kOpaqueAlpha = 0xFF;
|
||||
const uint8_t kTransparentAlpha = 0x00;
|
||||
|
||||
void AlphaBlend(const pp::ImageData& src, const pp::Rect& src_rc,
|
||||
pp::ImageData* dest, const pp::Point& dest_origin,
|
||||
uint8 alpha_adjustment);
|
||||
void AlphaBlend(const pp::ImageData& src,
|
||||
const pp::Rect& src_rc,
|
||||
pp::ImageData* dest,
|
||||
const pp::Point& dest_origin,
|
||||
uint8_t alpha_adjustment);
|
||||
|
||||
// Fill rectangle with gradient horizontally or vertically. Start is a color of
|
||||
// top-left point of the rectangle, end color is a color of
|
||||
// top-right (horizontal==true) or bottom-left (horizontal==false) point.
|
||||
void GradientFill(pp::ImageData* image,
|
||||
const pp::Rect& rc,
|
||||
uint32 start_color,
|
||||
uint32 end_color,
|
||||
uint32_t start_color,
|
||||
uint32_t end_color,
|
||||
bool horizontal);
|
||||
|
||||
// Fill dirty rectangle with gradient, where gradient color set for corners of
|
||||
@ -36,10 +39,10 @@ void GradientFill(pp::Instance* instance,
|
||||
pp::ImageData* image,
|
||||
const pp::Rect& dirty_rc,
|
||||
const pp::Rect& gradient_rc,
|
||||
uint32 start_color,
|
||||
uint32 end_color,
|
||||
uint32_t start_color,
|
||||
uint32_t end_color,
|
||||
bool horizontal,
|
||||
uint8 transparency);
|
||||
uint8_t transparency);
|
||||
|
||||
// Copy one image into another. If stretch is true, the result occupy the entire
|
||||
// dest_rc. If stretch is false, dest_rc.point will be used as an origin of the
|
||||
@ -50,7 +53,7 @@ void CopyImage(const pp::ImageData& src, const pp::Rect& src_rc,
|
||||
bool stretch);
|
||||
|
||||
// Fill in rectangle with specified color.
|
||||
void FillRect(pp::ImageData* image, const pp::Rect& rc, uint32 color);
|
||||
void FillRect(pp::ImageData* image, const pp::Rect& rc, uint32_t color);
|
||||
|
||||
// Shadow Matrix contains matrix for shadow rendering. To reduce amount of
|
||||
// calculations user may choose to cache matrix and reuse it if nothing changed.
|
||||
@ -62,21 +65,23 @@ class ShadowMatrix {
|
||||
// If factor == 1, smoothing will be linear from 0 to the end (depth),
|
||||
// if 0 < factor < 1, smoothing will drop faster near 0.
|
||||
// if factor > 1, smoothing will drop faster near the end (depth).
|
||||
ShadowMatrix(uint32 depth, double factor, uint32 background);
|
||||
ShadowMatrix(uint32_t depth, double factor, uint32_t background);
|
||||
|
||||
~ShadowMatrix();
|
||||
|
||||
uint32 GetValue(int32 x, int32 y) const { return matrix_[y * depth_ + x]; }
|
||||
uint32_t GetValue(int32_t x, int32_t y) const {
|
||||
return matrix_[y * depth_ + x];
|
||||
}
|
||||
|
||||
uint32 depth() const { return depth_; }
|
||||
uint32_t depth() const { return depth_; }
|
||||
double factor() const { return factor_; }
|
||||
uint32 background() const { return background_; }
|
||||
uint32_t background() const { return background_; }
|
||||
|
||||
private:
|
||||
uint32 depth_;
|
||||
uint32_t depth_;
|
||||
double factor_;
|
||||
uint32 background_;
|
||||
std::vector<uint32> matrix_;
|
||||
uint32_t background_;
|
||||
std::vector<uint32_t> matrix_;
|
||||
};
|
||||
|
||||
// Draw shadow on the image using provided ShadowMatrix.
|
||||
|
@ -4,6 +4,9 @@
|
||||
|
||||
#include "pdf/out_of_process_instance.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <algorithm> // for min/max()
|
||||
#define _USE_MATH_DEFINES // for M_PI
|
||||
#include <cmath> // for log() and pow()
|
||||
@ -816,11 +819,11 @@ int OutOfProcessInstance::GetDocumentPixelHeight() const {
|
||||
ceil(document_size_.height() * zoom_ * device_scale_));
|
||||
}
|
||||
|
||||
void OutOfProcessInstance::FillRect(const pp::Rect& rect, uint32 color) {
|
||||
void OutOfProcessInstance::FillRect(const pp::Rect& rect, uint32_t color) {
|
||||
DCHECK(!image_data_.is_null() || rect.IsEmpty());
|
||||
uint32* buffer_start = static_cast<uint32*>(image_data_.data());
|
||||
uint32_t* buffer_start = static_cast<uint32_t*>(image_data_.data());
|
||||
int stride = image_data_.stride();
|
||||
uint32* ptr = buffer_start + rect.y() * stride / 4 + rect.x();
|
||||
uint32_t* ptr = buffer_start + rect.y() * stride / 4 + rect.x();
|
||||
int height = rect.height();
|
||||
int width = rect.width();
|
||||
for (int y = 0; y < height; ++y) {
|
||||
@ -1252,8 +1255,8 @@ void OutOfProcessInstance::DocumentHasUnsupportedFeature(
|
||||
pp::PDF::HasUnsupportedFeature(this);
|
||||
}
|
||||
|
||||
void OutOfProcessInstance::DocumentLoadProgress(uint32 available,
|
||||
uint32 doc_size) {
|
||||
void OutOfProcessInstance::DocumentLoadProgress(uint32_t available,
|
||||
uint32_t doc_size) {
|
||||
double progress = 0.0;
|
||||
if (doc_size == 0) {
|
||||
// Document size is unknown. Use heuristics.
|
||||
@ -1380,7 +1383,7 @@ bool OutOfProcessInstance::IsPrintPreview() {
|
||||
return IsPrintPreviewUrl(url_);
|
||||
}
|
||||
|
||||
uint32 OutOfProcessInstance::GetBackgroundColor() {
|
||||
uint32_t OutOfProcessInstance::GetBackgroundColor() {
|
||||
return background_color_;
|
||||
}
|
||||
|
||||
|
@ -5,12 +5,15 @@
|
||||
#ifndef PDF_OUT_OF_PROCESS_INSTANCE_H_
|
||||
#define PDF_OUT_OF_PROCESS_INSTANCE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <queue>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "pdf/paint_manager.h"
|
||||
#include "pdf/pdf_engine.h"
|
||||
@ -125,10 +128,10 @@ class OutOfProcessInstance : public pp::Instance,
|
||||
void DocumentLoadFailed() override;
|
||||
pp::Instance* GetPluginInstance() override;
|
||||
void DocumentHasUnsupportedFeature(const std::string& feature) override;
|
||||
void DocumentLoadProgress(uint32 available, uint32 doc_size) override;
|
||||
void DocumentLoadProgress(uint32_t available, uint32_t doc_size) override;
|
||||
void FormTextFieldFocusChange(bool in_focus) override;
|
||||
bool IsPrintPreview() override;
|
||||
uint32 GetBackgroundColor() override;
|
||||
uint32_t GetBackgroundColor() override;
|
||||
void IsSelectingChanged(bool is_selecting) override;
|
||||
|
||||
// PreviewModeClient::Client implementation.
|
||||
@ -156,7 +159,7 @@ class OutOfProcessInstance : public pp::Instance,
|
||||
int GetDocumentPixelHeight() const;
|
||||
|
||||
// Draws a rectangle with the specified dimensions and color in our buffer.
|
||||
void FillRect(const pp::Rect& rect, uint32 color);
|
||||
void FillRect(const pp::Rect& rect, uint32_t color);
|
||||
|
||||
void LoadUrl(const std::string& url);
|
||||
void LoadPreviewUrl(const std::string& url);
|
||||
@ -229,7 +232,7 @@ class OutOfProcessInstance : public pp::Instance,
|
||||
|
||||
struct BackgroundPart {
|
||||
pp::Rect location;
|
||||
uint32 color;
|
||||
uint32_t color;
|
||||
};
|
||||
std::vector<BackgroundPart> background_parts_;
|
||||
|
||||
@ -333,7 +336,7 @@ class OutOfProcessInstance : public pp::Instance,
|
||||
bool stop_scrolling_;
|
||||
|
||||
// The background color of the PDF viewer.
|
||||
uint32 background_color_;
|
||||
uint32_t background_color_;
|
||||
|
||||
// The blank space above the first page of the document reserved for the
|
||||
// toolbar.
|
||||
|
@ -4,6 +4,9 @@
|
||||
|
||||
#include "pdf/paint_aggregator.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/logging.h"
|
||||
|
@ -4,6 +4,9 @@
|
||||
|
||||
#include "pdf/paint_manager.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/logging.h"
|
||||
|
@ -5,6 +5,8 @@
|
||||
#ifndef PDF_PAINT_MANAGER_H_
|
||||
#define PDF_PAINT_MANAGER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "pdf/paint_aggregator.h"
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "pdf/pdf.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
@ -5,6 +5,8 @@
|
||||
#ifndef PDF_PDF_ENGINE_H_
|
||||
#define PDF_PDF_ENGINE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "build/build_config.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
@ -36,9 +38,9 @@ namespace chrome_pdf {
|
||||
class Stream;
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
const uint32 kDefaultKeyModifier = PP_INPUTEVENT_MODIFIER_METAKEY;
|
||||
const uint32_t kDefaultKeyModifier = PP_INPUTEVENT_MODIFIER_METAKEY;
|
||||
#else // !OS_MACOSX
|
||||
const uint32 kDefaultKeyModifier = PP_INPUTEVENT_MODIFIER_CONTROLKEY;
|
||||
const uint32_t kDefaultKeyModifier = PP_INPUTEVENT_MODIFIER_CONTROLKEY;
|
||||
#endif // OS_MACOSX
|
||||
|
||||
// Do one time initialization of the SDK.
|
||||
@ -165,7 +167,8 @@ class PDFEngine {
|
||||
virtual void DocumentHasUnsupportedFeature(const std::string& feature) = 0;
|
||||
|
||||
// Notifies the client about document load progress.
|
||||
virtual void DocumentLoadProgress(uint32 available, uint32 doc_size) = 0;
|
||||
virtual void DocumentLoadProgress(uint32_t available,
|
||||
uint32_t doc_size) = 0;
|
||||
|
||||
// Notifies the client about focus changes for form text fields.
|
||||
virtual void FormTextFieldFocusChange(bool in_focus) = 0;
|
||||
@ -174,7 +177,7 @@ class PDFEngine {
|
||||
virtual bool IsPrintPreview() = 0;
|
||||
|
||||
// Get the background color of the PDF.
|
||||
virtual uint32 GetBackgroundColor() = 0;
|
||||
virtual uint32_t GetBackgroundColor() = 0;
|
||||
|
||||
// Sets selection status.
|
||||
virtual void IsSelectingChanged(bool is_selecting) {}
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "pdf/pdfium/pdfium_api_string_buffer_adapter.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/logging.h"
|
||||
|
@ -5,7 +5,9 @@
|
||||
#ifndef PDF_PDFIUM_PDFIUM_API_STRING_BUFFER_ADAPTER_H_
|
||||
#define PDF_PDFIUM_PDFIUM_API_STRING_BUFFER_ADAPTER_H_
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include <stddef.h>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/numerics/safe_math.h"
|
||||
|
||||
namespace chrome_pdf {
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "ppapi/c/pp_input_event.h"
|
||||
#include "ppapi/c/private/ppb_pdf.h"
|
||||
#include "ppapi/c/private/ppp_pdf.h"
|
||||
|
@ -5,11 +5,14 @@
|
||||
#include "pdf/pdfium/pdfium_engine.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "base/i18n/icu_encoding_detection.h"
|
||||
#include "base/i18n/icu_string_conversions.h"
|
||||
#include "base/json/json_writer.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "base/stl_util.h"
|
||||
@ -71,7 +74,7 @@ namespace {
|
||||
#define kHighlightColorG 193
|
||||
#define kHighlightColorB 218
|
||||
|
||||
const uint32 kPendingPageColor = 0xFFEEEEEE;
|
||||
const uint32_t kPendingPageColor = 0xFFEEEEEE;
|
||||
|
||||
#define kFormHighlightColor 0xFFE4DD
|
||||
#define kFormHighlightAlpha 100
|
||||
@ -3102,14 +3105,11 @@ void PDFiumEngine::Highlight(void* buffer,
|
||||
|
||||
for (int y = t; y < t + h; ++y) {
|
||||
for (int x = l; x < l + w; ++x) {
|
||||
uint8* pixel = static_cast<uint8*>(buffer) + y * stride + x * 4;
|
||||
uint8_t* pixel = static_cast<uint8_t*>(buffer) + y * stride + x * 4;
|
||||
// This is our highlight color.
|
||||
pixel[0] = static_cast<uint8>(
|
||||
pixel[0] * (kHighlightColorB / 255.0));
|
||||
pixel[1] = static_cast<uint8>(
|
||||
pixel[1] * (kHighlightColorG / 255.0));
|
||||
pixel[2] = static_cast<uint8>(
|
||||
pixel[2] * (kHighlightColorR / 255.0));
|
||||
pixel[0] = static_cast<uint8_t>(pixel[0] * (kHighlightColorB / 255.0));
|
||||
pixel[1] = static_cast<uint8_t>(pixel[1] * (kHighlightColorG / 255.0));
|
||||
pixel[2] = static_cast<uint8_t>(pixel[2] * (kHighlightColorR / 255.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3381,12 +3381,12 @@ void PDFiumEngine::DrawPageShadow(const pp::Rect& page_rc,
|
||||
|
||||
// Page drop shadow parameters.
|
||||
const double factor = 0.5;
|
||||
uint32 depth = std::max(
|
||||
std::max(page_rect.x() - shadow_rect.x(),
|
||||
page_rect.y() - shadow_rect.y()),
|
||||
std::max(shadow_rect.right() - page_rect.right(),
|
||||
shadow_rect.bottom() - page_rect.bottom()));
|
||||
depth = static_cast<uint32>(depth * 1.5) + 1;
|
||||
uint32_t depth =
|
||||
std::max(std::max(page_rect.x() - shadow_rect.x(),
|
||||
page_rect.y() - shadow_rect.y()),
|
||||
std::max(shadow_rect.right() - page_rect.right(),
|
||||
shadow_rect.bottom() - page_rect.bottom()));
|
||||
depth = static_cast<uint32_t>(depth * 1.5) + 1;
|
||||
|
||||
// We need to check depth only to verify our copy of shadow matrix is correct.
|
||||
if (!page_shadow_.get() || page_shadow_->depth() != depth)
|
||||
|
@ -5,11 +5,15 @@
|
||||
#ifndef PDF_PDFIUM_PDFIUM_ENGINE_H_
|
||||
#define PDF_PDFIUM_PDFIUM_ENGINE_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/time/time.h"
|
||||
#include "pdf/document_loader.h"
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "pdf/pdfium/pdfium_mem_buffer_file_read.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace chrome_pdf {
|
||||
|
@ -5,6 +5,7 @@
|
||||
#ifndef PDF_PDFIUM_PDFIUM_MEM_BUFFER_FILE_READ_H_
|
||||
#define PDF_PDFIUM_PDFIUM_MEM_BUFFER_FILE_READ_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "third_party/pdfium/public/fpdfview.h"
|
||||
|
@ -5,6 +5,8 @@
|
||||
#ifndef PDF_PDFIUM_PDFIUM_MEM_BUFFER_FILE_WRITE_
|
||||
#define PDF_PDFIUM_PDFIUM_MEM_BUFFER_FILE_WRITE_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "third_party/pdfium/public/fpdf_save.h"
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "pdf/pdfium/pdfium_page.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "pdf/preview_mode_client.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "base/logging.h"
|
||||
|
||||
namespace chrome_pdf {
|
||||
@ -145,9 +147,8 @@ void PreviewModeClient::DocumentHasUnsupportedFeature(
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
void PreviewModeClient::DocumentLoadProgress(uint32 available,
|
||||
uint32 doc_size) {
|
||||
}
|
||||
void PreviewModeClient::DocumentLoadProgress(uint32_t available,
|
||||
uint32_t doc_size) {}
|
||||
|
||||
void PreviewModeClient::FormTextFieldFocusChange(bool in_focus) {
|
||||
NOTREACHED();
|
||||
@ -158,7 +159,7 @@ bool PreviewModeClient::IsPrintPreview() {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 PreviewModeClient::GetBackgroundColor() {
|
||||
uint32_t PreviewModeClient::GetBackgroundColor() {
|
||||
NOTREACHED();
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,6 +5,8 @@
|
||||
#ifndef PDF_PREVIEW_MODE_CLIENT_H_
|
||||
#define PDF_PREVIEW_MODE_CLIENT_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -64,10 +66,10 @@ class PreviewModeClient : public PDFEngine::Client {
|
||||
virtual void DocumentLoadFailed();
|
||||
virtual pp::Instance* GetPluginInstance();
|
||||
virtual void DocumentHasUnsupportedFeature(const std::string& feature);
|
||||
virtual void DocumentLoadProgress(uint32 available, uint32 doc_size);
|
||||
virtual void DocumentLoadProgress(uint32_t available, uint32_t doc_size);
|
||||
virtual void FormTextFieldFocusChange(bool in_focus);
|
||||
virtual bool IsPrintPreview();
|
||||
virtual uint32 GetBackgroundColor();
|
||||
virtual uint32_t GetBackgroundColor();
|
||||
|
||||
private:
|
||||
Client* client_;
|
||||
|
Reference in New Issue
Block a user