mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-28 05:37:19 +00:00
Use std:: when necessary, and std::numeric_limits instead of INT_MAX
This commit is contained in:
parent
e822ddba4c
commit
ad856b2a55
@ -63,7 +63,7 @@ namespace {
|
||||
int nframes = sprite->totalFrames();
|
||||
int framew = sprite->width();
|
||||
int frameh = sprite->height();
|
||||
Fit result(framew*nframes, frameh, nframes, INT_MAX);
|
||||
Fit result(framew*nframes, frameh, nframes, std::numeric_limits<int>::max());
|
||||
int w, h;
|
||||
|
||||
for (w=2; w < framew; w*=2)
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include "she/surface.h"
|
||||
#include "she/system.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#define PREVIEW_TILED 1
|
||||
#define PREVIEW_FIT_ON_SCREEN 2
|
||||
|
||||
@ -120,10 +122,10 @@ protected:
|
||||
|
||||
// Change frame
|
||||
if (command != NULL &&
|
||||
(strcmp(command->short_name(), CommandId::GotoFirstFrame) == 0 ||
|
||||
strcmp(command->short_name(), CommandId::GotoPreviousFrame) == 0 ||
|
||||
strcmp(command->short_name(), CommandId::GotoNextFrame) == 0 ||
|
||||
strcmp(command->short_name(), CommandId::GotoLastFrame) == 0)) {
|
||||
(std::strcmp(command->short_name(), CommandId::GotoFirstFrame) == 0 ||
|
||||
std::strcmp(command->short_name(), CommandId::GotoPreviousFrame) == 0 ||
|
||||
std::strcmp(command->short_name(), CommandId::GotoNextFrame) == 0 ||
|
||||
std::strcmp(command->short_name(), CommandId::GotoLastFrame) == 0)) {
|
||||
m_context->executeCommand(command);
|
||||
invalidate();
|
||||
m_render.reset(NULL); // Re-render
|
||||
@ -131,7 +133,7 @@ protected:
|
||||
#if 0
|
||||
// Play the animation
|
||||
else if (command != NULL &&
|
||||
strcmp(command->short_name(), CommandId::PlayAnimation) == 0) {
|
||||
std::strcmp(command->short_name(), CommandId::PlayAnimation) == 0) {
|
||||
// TODO
|
||||
}
|
||||
#endif
|
||||
|
@ -17,14 +17,15 @@
|
||||
#include "app/find_widget.h"
|
||||
#include "app/load_widget.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/transaction.h"
|
||||
#include "app/ui/main_window.h"
|
||||
#include "app/ui/status_bar.h"
|
||||
#include "app/transaction.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
namespace app {
|
||||
|
||||
@ -126,8 +127,8 @@ static int get_max_layer_num(Layer* layer)
|
||||
{
|
||||
int max = 0;
|
||||
|
||||
if (strncmp(layer->name().c_str(), "Layer ", 6) == 0)
|
||||
max = strtol(layer->name().c_str()+6, NULL, 10);
|
||||
if (std::strncmp(layer->name().c_str(), "Layer ", 6) == 0)
|
||||
max = std::strtol(layer->name().c_str()+6, NULL, 10);
|
||||
|
||||
if (layer->isFolder()) {
|
||||
LayerIterator it = static_cast<LayerFolder*>(layer)->getLayerBegin();
|
||||
|
@ -41,6 +41,8 @@
|
||||
#include "ui/system.h"
|
||||
#include "ui/view.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace app {
|
||||
|
||||
using namespace ui;
|
||||
@ -334,14 +336,14 @@ bool MovingPixelsState::onKeyDown(Editor* editor, KeyMessage* msg)
|
||||
if (KeyboardShortcuts::instance()
|
||||
->getCommandFromKeyMessage(msg, &command, ¶ms)) {
|
||||
// We accept zoom commands.
|
||||
if (strcmp(command->short_name(), CommandId::Zoom) == 0) {
|
||||
if (std::strcmp(command->short_name(), CommandId::Zoom) == 0) {
|
||||
UIContext::instance()->executeCommand(command, params);
|
||||
return true;
|
||||
}
|
||||
// Intercept the "Cut" or "Copy" command to handle them locally
|
||||
// with the current m_pixelsMovement data.
|
||||
else if (strcmp(command->short_name(), CommandId::Cut) == 0 ||
|
||||
strcmp(command->short_name(), CommandId::Copy) == 0) {
|
||||
else if (std::strcmp(command->short_name(), CommandId::Cut) == 0 ||
|
||||
std::strcmp(command->short_name(), CommandId::Copy) == 0) {
|
||||
// Copy the floating image to the clipboard.
|
||||
{
|
||||
Document* document = editor->document();
|
||||
@ -353,7 +355,7 @@ bool MovingPixelsState::onKeyDown(Editor* editor, KeyMessage* msg)
|
||||
}
|
||||
|
||||
// In case of "Cut" command.
|
||||
if (strcmp(command->short_name(), CommandId::Cut) == 0) {
|
||||
if (std::strcmp(command->short_name(), CommandId::Cut) == 0) {
|
||||
// Discard the dragged image.
|
||||
m_pixelsMovement->discardImage();
|
||||
m_discarded = true;
|
||||
@ -367,7 +369,7 @@ bool MovingPixelsState::onKeyDown(Editor* editor, KeyMessage* msg)
|
||||
}
|
||||
// Flip Horizontally/Vertically commands are handled manually to
|
||||
// avoid dropping the floating region of pixels.
|
||||
else if (strcmp(command->short_name(), CommandId::Flip) == 0) {
|
||||
else if (std::strcmp(command->short_name(), CommandId::Flip) == 0) {
|
||||
if (FlipCommand* flipCommand = dynamic_cast<FlipCommand*>(command)) {
|
||||
flipCommand->loadParams(params);
|
||||
m_pixelsMovement->flipImage(flipCommand->getFlipType());
|
||||
@ -430,8 +432,8 @@ void MovingPixelsState::onBeforeCommandExecution(Command* command)
|
||||
if (moveMaskCmd->getTarget() == MoveMaskCommand::Content)
|
||||
return;
|
||||
}
|
||||
else if ((strcmp(command->short_name(), CommandId::Zoom) == 0) ||
|
||||
(strcmp(command->short_name(), CommandId::Scroll) == 0)) {
|
||||
else if ((std::strcmp(command->short_name(), CommandId::Zoom) == 0) ||
|
||||
(std::strcmp(command->short_name(), CommandId::Scroll) == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -9,9 +9,10 @@
|
||||
#define APP_UI_SKIN_SKIN_PART_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "base/shared_ptr.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace she {
|
||||
class Surface;
|
||||
}
|
||||
@ -26,14 +27,14 @@ namespace app {
|
||||
SkinPart();
|
||||
~SkinPart();
|
||||
|
||||
size_t size() const { return m_bitmaps.size(); }
|
||||
std::size_t size() const { return m_bitmaps.size(); }
|
||||
|
||||
void clear();
|
||||
|
||||
// It doesn't destroy the previous bitmap in the given "index".
|
||||
void setBitmap(size_t index, she::Surface* bitmap);
|
||||
void setBitmap(std::size_t index, she::Surface* bitmap);
|
||||
|
||||
she::Surface* getBitmap(size_t index) const {
|
||||
she::Surface* getBitmap(std::size_t index) const {
|
||||
return (index < m_bitmaps.size() ? m_bitmaps[index]: NULL);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2013 David Capello
|
||||
// Copyright (c) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
namespace base {
|
||||
|
||||
std::string get_pretty_memory_size(size_t memsize);
|
||||
std::string get_pretty_memory_size(std::size_t memsize);
|
||||
|
||||
} // namespace base
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2013 David Capello
|
||||
// Copyright (c) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -8,9 +8,11 @@
|
||||
#define BASE_MEMORY_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
void* base_malloc (size_t bytes);
|
||||
void* base_malloc0(size_t bytes);
|
||||
void* base_realloc(void* mem, size_t bytes);
|
||||
#include <cstddef>
|
||||
|
||||
void* base_malloc (std::size_t bytes);
|
||||
void* base_malloc0(std::size_t bytes);
|
||||
void* base_realloc(void* mem, std::size_t bytes);
|
||||
void base_free (void* mem);
|
||||
char* base_strdup (const char* string);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2014 David Capello
|
||||
// Copyright (c) 2001-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -22,7 +22,7 @@ public:
|
||||
typedef typename list_type::const_iterator const_iterator;
|
||||
|
||||
bool empty() const { return m_observers.empty(); }
|
||||
size_t size() const { return m_observers.size(); }
|
||||
std::size_t size() const { return m_observers.size(); }
|
||||
|
||||
// Adds the observer in the collection. The observer is owned by the
|
||||
// collection and will be destroyed calling the T::dispose() member
|
||||
|
@ -187,11 +187,11 @@ std::string ProgramOptions::value_of(const Option& option) const
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const base::ProgramOptions& po)
|
||||
{
|
||||
size_t maxOptionWidth = 0;
|
||||
std::size_t maxOptionWidth = 0;
|
||||
for (base::ProgramOptions::OptionList::const_iterator
|
||||
it=po.options().begin(), end=po.options().end(); it != end; ++it) {
|
||||
const base::ProgramOptions::Option* option = *it;
|
||||
size_t optionWidth =
|
||||
std::size_t optionWidth =
|
||||
6+option->name().size()+1+
|
||||
(option->doesRequireValue() ? option->getValueName().size()+1: 0);
|
||||
|
||||
@ -202,7 +202,7 @@ std::ostream& operator<<(std::ostream& os, const base::ProgramOptions& po)
|
||||
for (base::ProgramOptions::OptionList::const_iterator
|
||||
it=po.options().begin(), end=po.options().end(); it != end; ++it) {
|
||||
const base::ProgramOptions::Option* option = *it;
|
||||
size_t optionWidth = 6+option->name().size()+1+
|
||||
std::size_t optionWidth = 6+option->name().size()+1+
|
||||
(option->doesRequireValue() ? option->getValueName().size()+1: 0);
|
||||
|
||||
if (option->mnemonic() != 0)
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2013 David Capello
|
||||
// Copyright (c) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -20,14 +20,14 @@ public:
|
||||
typedef typename Items::iterator iterator;
|
||||
typedef typename Items::const_iterator const_iterator;
|
||||
|
||||
RecentItems(size_t limit) : m_limit(limit) { }
|
||||
RecentItems(std::size_t limit) : m_limit(limit) { }
|
||||
|
||||
const_iterator begin() { return m_items.begin(); }
|
||||
const_iterator end() { return m_items.end(); }
|
||||
|
||||
bool empty() const { return m_items.empty(); }
|
||||
size_t size() const { return m_items.size(); }
|
||||
size_t limit() const { return m_limit; }
|
||||
std::size_t size() const { return m_items.size(); }
|
||||
std::size_t limit() const { return m_limit; }
|
||||
|
||||
void addItem(const T& item) {
|
||||
iterator it = std::find(m_items.begin(), m_items.end(), item);
|
||||
@ -57,7 +57,7 @@ public:
|
||||
|
||||
private:
|
||||
Items m_items;
|
||||
size_t m_limit;
|
||||
std::size_t m_limit;
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
|
@ -20,7 +20,7 @@ void replace_string(
|
||||
if (replace_this.empty()) // Do nothing case
|
||||
return;
|
||||
|
||||
size_t i = 0;
|
||||
std::size_t i = 0;
|
||||
while (true) {
|
||||
i = subject.find(replace_this, i);
|
||||
if (i == std::string::npos)
|
||||
@ -29,5 +29,5 @@ void replace_string(
|
||||
i += with_that.size();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace base
|
||||
|
@ -42,7 +42,7 @@ Sha1 Sha1::calculateFromFile(const std::string& fileName)
|
||||
unsigned char buf[1024];
|
||||
while (file.good()) {
|
||||
file.read((char*)buf, 1024);
|
||||
size_t len = (size_t)file.gcount();
|
||||
std::size_t len = (std::size_t)file.gcount();
|
||||
if (len > 0)
|
||||
SHA1Input(&sha, buf, len);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2013 David Capello
|
||||
// Copyright (c) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -38,10 +38,10 @@ void base::split_string(const std::string& string,
|
||||
std::vector<std::string>& parts,
|
||||
const std::string& separators)
|
||||
{
|
||||
size_t elements = 1 + std::count_if(string.begin(), string.end(), is_separator(&separators));
|
||||
std::size_t elements = 1 + std::count_if(string.begin(), string.end(), is_separator(&separators));
|
||||
parts.reserve(elements);
|
||||
|
||||
size_t beg = 0, end;
|
||||
std::size_t beg = 0, end;
|
||||
while (true) {
|
||||
end = string.find_first_of(separators, beg);
|
||||
if (end != std::string::npos) {
|
||||
|
@ -83,7 +83,7 @@ std::wstring from_utf8(const std::string& src)
|
||||
#else
|
||||
|
||||
// Based on Allegro Unicode code (allegro/src/unicode.c)
|
||||
static size_t insert_utf8_char(std::string* result, wchar_t chr)
|
||||
static std::size_t insert_utf8_char(std::string* result, wchar_t chr)
|
||||
{
|
||||
int size, bits, b, i;
|
||||
|
||||
@ -129,7 +129,7 @@ std::string to_utf8(const std::wstring& src)
|
||||
|
||||
// Get required size to reserve a string so string::push_back()
|
||||
// doesn't need to reallocate its data.
|
||||
size_t required_size = 0;
|
||||
std::size_t required_size = 0;
|
||||
for (it = begin; it != end; ++it)
|
||||
required_size += insert_utf8_char(NULL, *it);
|
||||
if (!required_size)
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Base Library
|
||||
// Copyright (c) 2001-2013 David Capello
|
||||
// Copyright (c) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -36,19 +36,19 @@ namespace base {
|
||||
Version& revision(int digit) { (*this)[2] = digit; return *this; }
|
||||
Version& build(int digit) { (*this)[3] = digit; return *this; }
|
||||
|
||||
size_t size() const {
|
||||
std::size_t size() const {
|
||||
return m_digits.size();
|
||||
}
|
||||
|
||||
// operator[] that can be used to set version digits.
|
||||
int& operator[](size_t index) {
|
||||
int& operator[](std::size_t index) {
|
||||
if (index >= m_digits.size())
|
||||
m_digits.resize(index+1);
|
||||
return m_digits[index];
|
||||
}
|
||||
|
||||
// operator[] that can be used to get version digits.
|
||||
int operator[](size_t index) const {
|
||||
int operator[](std::size_t index) const {
|
||||
if (index < m_digits.size())
|
||||
return m_digits[index];
|
||||
else
|
||||
|
@ -112,9 +112,9 @@ Cel* Cel::link() const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t Cel::links() const
|
||||
std::size_t Cel::links() const
|
||||
{
|
||||
size_t links = 0;
|
||||
std::size_t links = 0;
|
||||
|
||||
Sprite* sprite = this->sprite();
|
||||
for (frame_t fr=0; fr<sprite->totalFrames(); ++fr) {
|
||||
|
@ -44,7 +44,7 @@ namespace doc {
|
||||
Document* document() const;
|
||||
Sprite* sprite() const;
|
||||
Cel* link() const;
|
||||
size_t links() const;
|
||||
std::size_t links() const;
|
||||
gfx::Rect bounds() const;
|
||||
|
||||
// You should change the frame only if the cel isn't member of a
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Document Library
|
||||
// Copyright (c) 2001-2014 David Capello
|
||||
// Copyright (c) 2001-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -28,24 +28,24 @@ Palette* load_col_file(const char* filename)
|
||||
{
|
||||
Palette *pal = NULL;
|
||||
int c, r, g, b;
|
||||
FILE *f;
|
||||
FILE* f;
|
||||
|
||||
f = fopen(filename, "rb");
|
||||
f = std::fopen(filename, "rb");
|
||||
if (!f)
|
||||
return NULL;
|
||||
|
||||
// Get file size.
|
||||
fseek(f, 0, SEEK_END);
|
||||
size_t size = ftell(f);
|
||||
div_t d = div(size-8, 3);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
std::fseek(f, 0, SEEK_END);
|
||||
std::size_t size = std::ftell(f);
|
||||
std::div_t d = std::div(size-8, 3);
|
||||
std::fseek(f, 0, SEEK_SET);
|
||||
|
||||
bool pro = (size == 768)? false: true; // is Animator Pro format?
|
||||
if (!(size) || (pro && d.rem)) { // Invalid format
|
||||
if (!(size) || (pro && d.rem)) { // Invalid format
|
||||
fclose(f);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Animator format
|
||||
if (!pro) {
|
||||
pal = new Palette(frame_t(0), 256);
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Document Library
|
||||
// Copyright (c) 2001-2014 David Capello
|
||||
// Copyright (c) 2001-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -11,18 +11,19 @@
|
||||
#include "base/shared_ptr.h"
|
||||
|
||||
#include <vector>
|
||||
#include <cstddef>
|
||||
|
||||
namespace doc {
|
||||
|
||||
class ImageBuffer {
|
||||
public:
|
||||
ImageBuffer(size_t size = 1) : m_buffer(size) {
|
||||
ImageBuffer(std::size_t size = 1) : m_buffer(size) {
|
||||
}
|
||||
|
||||
size_t size() const { return m_buffer.size(); }
|
||||
std::size_t size() const { return m_buffer.size(); }
|
||||
uint8_t* buffer() { return &m_buffer[0]; }
|
||||
|
||||
void resizeIfNecessary(size_t size) {
|
||||
void resizeIfNecessary(std::size_t size) {
|
||||
if (size > m_buffer.size())
|
||||
m_buffer.resize(size);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Document Library
|
||||
// Copyright (c) 2001-2014 David Capello
|
||||
// Copyright (c) 2001-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -8,6 +8,9 @@
|
||||
#define DOC_IMAGE_IMPL_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "doc/blend.h"
|
||||
#include "doc/image.h"
|
||||
#include "doc/image_bits.h"
|
||||
@ -54,9 +57,9 @@ namespace doc {
|
||||
: Image(static_cast<PixelFormat>(Traits::pixel_format), width, height)
|
||||
, m_buffer(buffer)
|
||||
{
|
||||
size_t for_rows = sizeof(address_t) * height;
|
||||
size_t rowstride_bytes = Traits::getRowStrideBytes(width);
|
||||
size_t required_size = for_rows + rowstride_bytes*height;
|
||||
std::size_t for_rows = sizeof(address_t) * height;
|
||||
std::size_t rowstride_bytes = Traits::getRowStrideBytes(width);
|
||||
std::size_t required_size = for_rows + rowstride_bytes*height;
|
||||
|
||||
if (!m_buffer)
|
||||
m_buffer.reset(new ImageBuffer(required_size));
|
||||
@ -121,7 +124,7 @@ namespace doc {
|
||||
src_address = src->address(area.src.x, area.src.y);
|
||||
dst_address = address(area.dst.x, area.dst.y);
|
||||
|
||||
memcpy(dst_address, src_address, bytes);
|
||||
std::memcpy(dst_address, src_address, bytes);
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,13 +208,13 @@ namespace doc {
|
||||
|
||||
template<>
|
||||
inline void ImageImpl<IndexedTraits>::clear(color_t color) {
|
||||
memset(m_bits, color, width()*height());
|
||||
std::memset(m_bits, color, width()*height());
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void ImageImpl<BitmapTraits>::clear(color_t color) {
|
||||
memset(m_bits, (color ? 0xff: 0x00),
|
||||
BitmapTraits::getRowStrideBytes(width()) * height());
|
||||
std::memset(m_bits, (color ? 0xff: 0x00),
|
||||
BitmapTraits::getRowStrideBytes(width()) * height());
|
||||
}
|
||||
|
||||
template<>
|
||||
@ -219,7 +222,7 @@ namespace doc {
|
||||
ASSERT(x >= 0 && x < width());
|
||||
ASSERT(y >= 0 && y < height());
|
||||
|
||||
div_t d = div(x, 8);
|
||||
std::div_t d = std::div(x, 8);
|
||||
return ((*(m_rows[y] + d.quot)) & (1<<d.rem)) ? 1: 0;
|
||||
}
|
||||
|
||||
@ -228,7 +231,7 @@ namespace doc {
|
||||
ASSERT(x >= 0 && x < width());
|
||||
ASSERT(y >= 0 && y < height());
|
||||
|
||||
div_t d = div(x, 8);
|
||||
std::div_t d = std::div(x, 8);
|
||||
if (color)
|
||||
(*(m_rows[y] + d.quot)) |= (1 << d.rem);
|
||||
else
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Document Library
|
||||
// Copyright (c) 2001-2014 David Capello
|
||||
// Copyright (c) 2001-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -45,8 +45,8 @@ TYPED_TEST(ImageAllTypes, PutGetAndIterators)
|
||||
lengths.push_back(33);
|
||||
|
||||
std::vector<gfx::Size> sizes;
|
||||
for (size_t i=0; i<lengths.size(); ++i)
|
||||
for (size_t j=0; j<lengths.size(); ++j)
|
||||
for (std::size_t i=0; i<lengths.size(); ++i)
|
||||
for (std::size_t j=0; j<lengths.size(); ++j)
|
||||
sizes.push_back(gfx::Size(lengths[j], lengths[i]));
|
||||
|
||||
for (std::vector<gfx::Size>::iterator sizes_it=sizes.begin(); sizes_it!=sizes.end(); ++sizes_it) {
|
||||
@ -160,8 +160,8 @@ TYPED_TEST(ImageAllTypes, DrawHLine)
|
||||
lengths.push_back(33);
|
||||
|
||||
std::vector<gfx::Size> sizes;
|
||||
for (size_t i=0; i<lengths.size(); ++i)
|
||||
for (size_t j=0; j<lengths.size(); ++j)
|
||||
for (std::size_t i=0; i<lengths.size(); ++i)
|
||||
for (std::size_t j=0; j<lengths.size(); ++j)
|
||||
sizes.push_back(gfx::Size(lengths[j], lengths[i]));
|
||||
|
||||
for (std::vector<gfx::Size>::iterator sizes_it=sizes.begin(); sizes_it!=sizes.end(); ++sizes_it) {
|
||||
@ -169,7 +169,7 @@ TYPED_TEST(ImageAllTypes, DrawHLine)
|
||||
int h = sizes_it->h;
|
||||
UniquePtr<Image> image(Image::create(ImageTraits::pixel_format, w, h));
|
||||
image->clear(0);
|
||||
|
||||
|
||||
for (int c=0; c<100; ++c) {
|
||||
int x = rand() % w;
|
||||
int y = rand() % h;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Document Library
|
||||
// Copyright (c) 2001-2014 David Capello
|
||||
// Copyright (c) 2001-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -57,7 +57,7 @@ namespace doc {
|
||||
ItemsIterator begin() { return m_items.begin(); }
|
||||
ItemsIterator end() { return m_items.end(); }
|
||||
|
||||
size_t size() const { return m_items.size(); }
|
||||
std::size_t size() const { return m_items.size(); }
|
||||
bool empty() const { return m_items.empty(); }
|
||||
|
||||
private:
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Document Library
|
||||
// Copyright (c) 2001-2014 David Capello
|
||||
// Copyright (c) 2001-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -15,6 +15,7 @@
|
||||
#include "doc/image.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
|
||||
namespace doc {
|
||||
|
||||
@ -124,7 +125,7 @@ int Palette::countDiff(const Palette* other, int* from, int* to) const
|
||||
|
||||
bool Palette::isBlack() const
|
||||
{
|
||||
for (size_t c=0; c<m_colors.size(); ++c)
|
||||
for (std::size_t c=0; c<m_colors.size(); ++c)
|
||||
if (getEntry(c) != rgba(0, 0, 0, 255))
|
||||
return false;
|
||||
|
||||
@ -429,7 +430,7 @@ int Palette::findBestfit(int r, int g, int b, int mask_index) const
|
||||
bestfit_init();
|
||||
|
||||
bestfit = 0;
|
||||
lowest = INT_MAX;
|
||||
lowest = std::numeric_limits<int>::max();
|
||||
|
||||
r >>= 3;
|
||||
g >>= 3;
|
||||
|
@ -398,8 +398,8 @@ void Sprite::setFrameDuration(frame_t frame, int msecs)
|
||||
void Sprite::setFrameRangeDuration(frame_t from, frame_t to, int msecs)
|
||||
{
|
||||
std::fill(
|
||||
m_frlens.begin()+(size_t)from,
|
||||
m_frlens.begin()+(size_t)to+1, MID(1, msecs, 65535));
|
||||
m_frlens.begin()+(std::size_t)from,
|
||||
m_frlens.begin()+(std::size_t)to+1, MID(1, msecs, 65535));
|
||||
}
|
||||
|
||||
void Sprite::setDurationForAllFrames(int msecs)
|
||||
|
@ -9,11 +9,11 @@
|
||||
#define FILTERS_MEDIAN_FILTER_PROCESS_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "filters/filter.h"
|
||||
#include "filters/tiled_mode.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace filters {
|
||||
|
||||
class MedianFilter : public Filter {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Code Generator
|
||||
// Copyright (c) 2014 David Capello
|
||||
// Copyright (c) 2014, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -15,7 +15,7 @@ inline std::string convert_xmlid_to_cppid(const std::string& xmlid, bool firstLe
|
||||
{
|
||||
bool firstLetter = firstLetterUpperCase;
|
||||
std::string cppid;
|
||||
for (size_t i=0; i<xmlid.size(); ++i) {
|
||||
for (std::size_t i=0; i<xmlid.size(); ++i) {
|
||||
if (xmlid[i] == '_') {
|
||||
firstLetter = true;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Gfx Library
|
||||
// Copyright (C) 2001-2014 David Capello
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -25,7 +25,7 @@ namespace gfx {
|
||||
const_iterator begin() const { return m_rects.begin(); }
|
||||
const_iterator end() const { return m_rects.end(); }
|
||||
|
||||
size_t size() const { return m_rects.size(); }
|
||||
std::size_t size() const { return m_rects.size(); }
|
||||
const Rect& operator[](int i) const { return m_rects[i]; }
|
||||
|
||||
// Adds a new rectangle.
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Gfx Library
|
||||
// Copyright (C) 2001-2013 David Capello
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -19,7 +19,7 @@
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
namespace gfx {
|
||||
|
||||
inline Rect to_rect(const pixman_box32& extends)
|
||||
@ -109,7 +109,7 @@ Rect Region::bounds() const
|
||||
return to_rect(*pixman_region32_extents(&m_region));
|
||||
}
|
||||
|
||||
size_t Region::size() const
|
||||
std::size_t Region::size() const
|
||||
{
|
||||
return pixman_region32_n_rects(&m_region);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Gfx Library
|
||||
// Copyright (C) 2001-2013 David Capello
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -82,7 +82,7 @@ namespace gfx {
|
||||
|
||||
bool isEmpty() const;
|
||||
Rect bounds() const;
|
||||
size_t size() const;
|
||||
std::size_t size() const;
|
||||
|
||||
void clear();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Gfx Library
|
||||
// Copyright (C) 2001-2013 David Capello
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -45,7 +45,7 @@ void Transformation::transformBox(Corners& corners) const
|
||||
// critical at this point.
|
||||
|
||||
corners = m_bounds;
|
||||
for (size_t c=0; c<corners.size(); ++c)
|
||||
for (std::size_t c=0; c<corners.size(); ++c)
|
||||
corners[c] = Transformation::rotatePoint(corners[c], pivot_f, m_angle);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Gfx Library
|
||||
// Copyright (C) 2001-2013 David Capello
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -31,7 +31,7 @@ public:
|
||||
|
||||
Corners() : m_corners(NUM_OF_CORNERS) { }
|
||||
|
||||
size_t size() const { return m_corners.size(); }
|
||||
std::size_t size() const { return m_corners.size(); }
|
||||
|
||||
PointT<double>& operator[](int index) { return m_corners[index]; }
|
||||
const PointT<double>& operator[](int index) const { return m_corners[index]; }
|
||||
|
@ -74,14 +74,14 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
size_t writeBody(char* ptr, size_t bytes)
|
||||
std::size_t writeBody(char* ptr, std::size_t bytes)
|
||||
{
|
||||
ASSERT(m_response != NULL);
|
||||
m_response->write(ptr, bytes);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
static size_t writeBodyCallback(char* ptr, size_t size, size_t nmemb, void* userdata)
|
||||
static std::size_t writeBodyCallback(char* ptr, std::size_t size, std::size_t nmemb, void* userdata)
|
||||
{
|
||||
HttpRequestImpl* req = reinterpret_cast<HttpRequestImpl*>(userdata);
|
||||
return req->writeBody(ptr, size*nmemb);
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
namespace net {
|
||||
|
||||
void HttpResponse::write(const char* data, size_t length)
|
||||
void HttpResponse::write(const char* data, std::size_t length)
|
||||
{
|
||||
m_stream->write(data, length);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
void setStatus(int status) { m_status = status; }
|
||||
|
||||
// Writes data in the stream.
|
||||
void write(const char* data, size_t length);
|
||||
void write(const char* data, std::size_t length);
|
||||
|
||||
private:
|
||||
int m_status;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Render Library
|
||||
// Copyright (c) 2001-2014 David Capello
|
||||
// Copyright (c) 2001-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -39,21 +39,21 @@ namespace render {
|
||||
// Returns the number of points in the specified histogram
|
||||
// entry. Each index (i, j, k) is in the range of the
|
||||
// histogram i=[0,RElements), etc.
|
||||
size_t at(int i, int j, int k) const
|
||||
std::size_t at(int i, int j, int k) const
|
||||
{
|
||||
return m_histogram[histogramIndex(i, j, k)];
|
||||
}
|
||||
|
||||
// Add the specified "color" in the histogram as many times as the
|
||||
// specified value in "count".
|
||||
void addSamples(uint32_t color, size_t count = 1)
|
||||
void addSamples(uint32_t color, std::size_t count = 1)
|
||||
{
|
||||
int i = histogramIndex(color);
|
||||
|
||||
if (m_histogram[i] < std::numeric_limits<size_t>::max()-count) // Avoid overflow
|
||||
if (m_histogram[i] < std::numeric_limits<std::size_t>::max()-count) // Avoid overflow
|
||||
m_histogram[i] += count;
|
||||
else
|
||||
m_histogram[i] = std::numeric_limits<size_t>::max();
|
||||
m_histogram[i] = std::numeric_limits<std::size_t>::max();
|
||||
|
||||
// Accurate colors are used only for less than 256 colors. If the
|
||||
// image has more than 256 colors the m_histogram is used
|
||||
@ -105,20 +105,20 @@ namespace render {
|
||||
// Converts input color in a index for the histogram. It reduces
|
||||
// each 8-bit component to the resolution given in the template
|
||||
// parameters.
|
||||
size_t histogramIndex(uint32_t color) const
|
||||
std::size_t histogramIndex(uint32_t color) const
|
||||
{
|
||||
return histogramIndex((rgba_getr(color) >> (8 - RBits)),
|
||||
(rgba_getg(color) >> (8 - GBits)),
|
||||
(rgba_getb(color) >> (8 - BBits)));
|
||||
}
|
||||
|
||||
size_t histogramIndex(int i, int j, int k) const
|
||||
std::size_t histogramIndex(int i, int j, int k) const
|
||||
{
|
||||
return i | (j << RBits) | (k << (RBits+GBits));
|
||||
}
|
||||
|
||||
// 3D histogram (the index in the histogram is calculated through histogramIndex() function).
|
||||
std::vector<size_t> m_histogram;
|
||||
std::vector<std::size_t> m_histogram;
|
||||
|
||||
// High precision histogram to create an accurate palette if RGB
|
||||
// source images contains less than 256 colors.
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Render Library
|
||||
// Copyright (c) 2001-2014 David Capello
|
||||
// Copyright (c) 2001-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -21,9 +21,9 @@ namespace render {
|
||||
// These classes are used as parameters for some Box's generic
|
||||
// member functions, so we can access to a different axis using
|
||||
// the same generic function (i=Red channel in RAxisGetter, etc.).
|
||||
struct RAxisGetter { static size_t at(const Histogram& h, int i, int j, int k) { return h.at(i, j, k); } };
|
||||
struct GAxisGetter { static size_t at(const Histogram& h, int i, int j, int k) { return h.at(j, i, k); } };
|
||||
struct BAxisGetter { static size_t at(const Histogram& h, int i, int j, int k) { return h.at(j, k, i); } };
|
||||
struct RAxisGetter { static std::size_t at(const Histogram& h, int i, int j, int k) { return h.at(i, j, k); } };
|
||||
struct GAxisGetter { static std::size_t at(const Histogram& h, int i, int j, int k) { return h.at(j, i, k); } };
|
||||
struct BAxisGetter { static std::size_t at(const Histogram& h, int i, int j, int k) { return h.at(j, k, i); } };
|
||||
|
||||
// These classes are used as template parameter to split a Box
|
||||
// along an axis (see splitAlongAxis)
|
||||
@ -82,8 +82,8 @@ namespace render {
|
||||
// all histogram's points inside the box.
|
||||
uint32_t meanColor(const Histogram& histogram) const
|
||||
{
|
||||
size_t r = 0, g = 0, b = 0;
|
||||
size_t count = 0;
|
||||
std::size_t r = 0, g = 0, b = 0;
|
||||
std::size_t count = 0;
|
||||
int i, j, k;
|
||||
|
||||
for (i=r1; i<=r2; ++i)
|
||||
@ -125,9 +125,9 @@ namespace render {
|
||||
}
|
||||
|
||||
// Returns the number of histogram's points inside the box bounds.
|
||||
size_t countPoints(const Histogram& histogram) const
|
||||
std::size_t countPoints(const Histogram& histogram) const
|
||||
{
|
||||
size_t count = 0;
|
||||
std::size_t count = 0;
|
||||
int i, j, k;
|
||||
|
||||
for (i=r1; i<=r2; ++i)
|
||||
@ -187,8 +187,8 @@ namespace render {
|
||||
{
|
||||
// These two variables will be used to count how many points are
|
||||
// in each side of the box if we split it in "i" position.
|
||||
size_t totalPoints1 = 0;
|
||||
size_t totalPoints2 = this->points;
|
||||
std::size_t totalPoints1 = 0;
|
||||
std::size_t totalPoints2 = this->points;
|
||||
int i, j, k;
|
||||
|
||||
// We will try to split the box along the "i" axis. Imagine a
|
||||
@ -197,7 +197,7 @@ namespace render {
|
||||
// the number of points in both sides of the plane are
|
||||
// approximated the same.
|
||||
for (i=i1; i<=i2; ++i) {
|
||||
size_t planePoints = 0;
|
||||
std::size_t planePoints = 0;
|
||||
|
||||
// We count all points in "i" plane.
|
||||
for (j=j1; j<=j2; ++j)
|
||||
@ -236,7 +236,7 @@ namespace render {
|
||||
|
||||
int r1, g1, b1; // Min point (closest to origin)
|
||||
int r2, g2, b2; // Max point
|
||||
size_t points; // Number of points in the space which enclose this box
|
||||
std::size_t points; // Number of points in the space which enclose this box
|
||||
int volume;
|
||||
}; // end of class Box
|
||||
|
||||
@ -244,7 +244,7 @@ namespace render {
|
||||
// quantization for frame buffer display,", Computer Graphics,
|
||||
// 16(3), pp. 297-307 (1982)
|
||||
template<class Histogram>
|
||||
void median_cut(const Histogram& histogram, size_t maxBoxes, std::vector<uint32_t>& result)
|
||||
void median_cut(const Histogram& histogram, std::size_t maxBoxes, std::vector<uint32_t>& result)
|
||||
{
|
||||
// We need a priority queue to split bigger boxes first (see Box::operator<).
|
||||
std::priority_queue<Box<Histogram> > boxes;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2013 David Capello
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -324,7 +324,7 @@ std::string Accelerator::toString() const
|
||||
"KEY_COLON2",
|
||||
"Kanji",
|
||||
};
|
||||
static size_t table_size = sizeof(table) / sizeof(table[0]);
|
||||
static std::size_t table_size = sizeof(table) / sizeof(table[0]);
|
||||
|
||||
std::string buf;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2013 David Capello
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -55,7 +55,7 @@ namespace ui {
|
||||
const_iterator end() const { return m_list.end(); }
|
||||
|
||||
bool empty() const { return m_list.empty(); }
|
||||
size_t size() const { return m_list.size(); }
|
||||
std::size_t size() const { return m_list.size(); }
|
||||
|
||||
const ui::Accelerator& front() const { return m_list.front(); }
|
||||
|
||||
|
@ -191,7 +191,7 @@ void ComboBox::removeItem(ListItem* item)
|
||||
|
||||
void ComboBox::removeItem(int itemIndex)
|
||||
{
|
||||
ASSERT(itemIndex >= 0 && (size_t)itemIndex < m_items.size());
|
||||
ASSERT(itemIndex >= 0 && (std::size_t)itemIndex < m_items.size());
|
||||
|
||||
ListItem* item = m_items[itemIndex];
|
||||
|
||||
@ -215,7 +215,7 @@ int ComboBox::getItemCount() const
|
||||
|
||||
ListItem* ComboBox::getItem(int itemIndex)
|
||||
{
|
||||
if (itemIndex >= 0 && (size_t)itemIndex < m_items.size()) {
|
||||
if (itemIndex >= 0 && (std::size_t)itemIndex < m_items.size()) {
|
||||
return m_items[itemIndex];
|
||||
}
|
||||
else
|
||||
@ -224,7 +224,7 @@ ListItem* ComboBox::getItem(int itemIndex)
|
||||
|
||||
const std::string& ComboBox::getItemText(int itemIndex) const
|
||||
{
|
||||
if (itemIndex >= 0 && (size_t)itemIndex < m_items.size()) {
|
||||
if (itemIndex >= 0 && (std::size_t)itemIndex < m_items.size()) {
|
||||
ListItem* item = m_items[itemIndex];
|
||||
return item->getText();
|
||||
}
|
||||
@ -237,7 +237,7 @@ const std::string& ComboBox::getItemText(int itemIndex) const
|
||||
|
||||
void ComboBox::setItemText(int itemIndex, const std::string& text)
|
||||
{
|
||||
ASSERT(itemIndex >= 0 && (size_t)itemIndex < m_items.size());
|
||||
ASSERT(itemIndex >= 0 && (std::size_t)itemIndex < m_items.size());
|
||||
|
||||
ListItem* item = m_items[itemIndex];
|
||||
item->setText(text);
|
||||
@ -285,7 +285,7 @@ int ComboBox::getSelectedItemIndex() const
|
||||
void ComboBox::setSelectedItemIndex(int itemIndex)
|
||||
{
|
||||
if (itemIndex >= 0 &&
|
||||
(size_t)itemIndex < m_items.size() &&
|
||||
(std::size_t)itemIndex < m_items.size() &&
|
||||
m_selected != itemIndex) {
|
||||
m_selected = itemIndex;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2014 David Capello
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -28,7 +28,7 @@
|
||||
|
||||
namespace ui {
|
||||
|
||||
Entry::Entry(size_t maxsize, const char *format, ...)
|
||||
Entry::Entry(std::size_t maxsize, const char *format, ...)
|
||||
: Widget(kEntryWidget)
|
||||
, m_timer(500, this)
|
||||
, m_maxsize(maxsize)
|
||||
@ -437,7 +437,7 @@ void Entry::onSetText()
|
||||
{
|
||||
Widget::onSetText();
|
||||
|
||||
if (m_caret >= 0 && (size_t)m_caret > getTextLength())
|
||||
if (m_caret >= 0 && (std::size_t)m_caret > getTextLength())
|
||||
m_caret = (int)getTextLength();
|
||||
}
|
||||
|
||||
@ -508,7 +508,7 @@ void Entry::executeCmd(EntryCmd cmd, int unicodeChar, bool shift_pressed)
|
||||
|
||||
// put the character
|
||||
if (text.size() < m_maxsize) {
|
||||
ASSERT((size_t)m_caret <= text.size());
|
||||
ASSERT((std::size_t)m_caret <= text.size());
|
||||
text.insert(m_caret++, 1, unicodeChar);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2013 David Capello
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -19,7 +19,7 @@ namespace ui {
|
||||
class Entry : public Widget
|
||||
{
|
||||
public:
|
||||
Entry(size_t maxsize, const char *format, ...);
|
||||
Entry(std::size_t maxsize, const char *format, ...);
|
||||
~Entry();
|
||||
|
||||
bool isPassword() const;
|
||||
@ -81,7 +81,7 @@ namespace ui {
|
||||
void showEditPopupMenu(const gfx::Point& pt);
|
||||
|
||||
Timer m_timer;
|
||||
size_t m_maxsize;
|
||||
std::size_t m_maxsize;
|
||||
int m_caret;
|
||||
int m_scroll;
|
||||
int m_select;
|
||||
|
@ -255,7 +255,7 @@ gfx::Size Graphics::doUIStringAlgorithm(const std::string& str, gfx::Color fg, g
|
||||
}
|
||||
|
||||
gfx::Size calculatedSize(0, 0);
|
||||
size_t beg, end, new_word_beg, old_end;
|
||||
std::size_t beg, end, new_word_beg, old_end;
|
||||
std::string line;
|
||||
int lineSeparation = 2*guiscale();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2013 David Capello
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -44,7 +44,7 @@ Grid::Grid(int columns, bool same_width_columns)
|
||||
|
||||
m_same_width_columns = same_width_columns;
|
||||
|
||||
for (size_t col=0; col<m_colstrip.size(); ++col) {
|
||||
for (std::size_t col=0; col<m_colstrip.size(); ++col) {
|
||||
m_colstrip[col].size = 0;
|
||||
m_colstrip[col].expand_count = 0;
|
||||
}
|
||||
@ -55,8 +55,8 @@ Grid::Grid(int columns, bool same_width_columns)
|
||||
Grid::~Grid()
|
||||
{
|
||||
// Delete all cells.
|
||||
for (size_t row=0; row<m_cells.size(); ++row)
|
||||
for (size_t col=0; col<m_cells[row].size(); ++col)
|
||||
for (std::size_t row=0; row<m_cells.size(); ++row)
|
||||
for (std::size_t col=0; col<m_cells[row].size(); ++col)
|
||||
delete m_cells[row][col];
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ void ListBox::selectIndex(int index)
|
||||
selectChild(child);
|
||||
}
|
||||
|
||||
size_t ListBox::getItemsCount() const
|
||||
std::size_t ListBox::getItemsCount() const
|
||||
{
|
||||
return getChildren().size();
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace ui {
|
||||
void selectChild(Widget* item);
|
||||
void selectIndex(int index);
|
||||
|
||||
size_t getItemsCount() const;
|
||||
std::size_t getItemsCount() const;
|
||||
|
||||
void centerScroll();
|
||||
void sortItems();
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2013 David Capello
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -32,6 +32,7 @@
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#include <limits>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
@ -1372,7 +1373,7 @@ static bool move_focus(Manager* manager, Message* msg)
|
||||
}
|
||||
|
||||
// Check if the new widget to put the focus is not in the wrong way.
|
||||
if ((*cmp) (list[c], x, y) < INT_MAX)
|
||||
if ((*cmp) (list[c], x, y) < std::numeric_limits<int>::max())
|
||||
focus = list[c];
|
||||
}
|
||||
// If only there are one widget, put the focus in this
|
||||
@ -1439,7 +1440,7 @@ static int cmp_left(Widget* widget, int x, int y)
|
||||
{
|
||||
int z = x - (widget->getBounds().x+widget->getBounds().w/2);
|
||||
if (z <= 0)
|
||||
return INT_MAX;
|
||||
return std::numeric_limits<int>::max();
|
||||
return z + ABS((widget->getBounds().y+widget->getBounds().h/2) - y) * 8;
|
||||
}
|
||||
|
||||
@ -1447,7 +1448,7 @@ static int cmp_right(Widget* widget, int x, int y)
|
||||
{
|
||||
int z = (widget->getBounds().x+widget->getBounds().w/2) - x;
|
||||
if (z <= 0)
|
||||
return INT_MAX;
|
||||
return std::numeric_limits<int>::max();
|
||||
return z + ABS((widget->getBounds().y+widget->getBounds().h/2) - y) * 8;
|
||||
}
|
||||
|
||||
@ -1455,7 +1456,7 @@ static int cmp_up(Widget* widget, int x, int y)
|
||||
{
|
||||
int z = y - (widget->getBounds().y+widget->getBounds().h/2);
|
||||
if (z <= 0)
|
||||
return INT_MAX;
|
||||
return std::numeric_limits<int>::max();
|
||||
return z + ABS((widget->getBounds().x+widget->getBounds().w/2) - x) * 8;
|
||||
}
|
||||
|
||||
@ -1463,7 +1464,7 @@ static int cmp_down(Widget* widget, int x, int y)
|
||||
{
|
||||
int z = (widget->getBounds().y+widget->getBounds().h/2) - y;
|
||||
if (z <= 0)
|
||||
return INT_MAX;
|
||||
return std::numeric_limits<int>::max();
|
||||
return z + ABS((widget->getBounds().x+widget->getBounds().w/2) - x) * 8;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2014 David Capello
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -35,7 +35,7 @@ void move_region(const Region& region, int dx, int dy)
|
||||
return;
|
||||
|
||||
she::ScopedSurfaceLock lock(display->getSurface());
|
||||
size_t nrects = region.size();
|
||||
std::size_t nrects = region.size();
|
||||
|
||||
// Blit directly screen to screen.
|
||||
if (nrects == 1) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2013 David Capello
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -19,6 +19,8 @@
|
||||
#include "ui/view.h"
|
||||
#include "ui/widget.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace ui {
|
||||
|
||||
static Theme* current_theme = NULL;
|
||||
@ -142,7 +144,7 @@ void drawTextBox(Graphics* g, Widget* widget,
|
||||
|
||||
// Without word-wrap
|
||||
if (!(widget->getAlign() & JI_WORDWRAP)) {
|
||||
end = strchr(beg, '\n');
|
||||
end = std::strchr(beg, '\n');
|
||||
if (end) {
|
||||
chr = *end;
|
||||
*end = 0;
|
||||
@ -152,7 +154,7 @@ void drawTextBox(Graphics* g, Widget* widget,
|
||||
else {
|
||||
old_end = NULL;
|
||||
for (beg_end=beg;;) {
|
||||
end = strpbrk(beg_end, " \n");
|
||||
end = std::strpbrk(beg_end, " \n");
|
||||
if (end) {
|
||||
chr = *end;
|
||||
*end = 0;
|
||||
|
@ -917,7 +917,7 @@ void Widget::flushRedraw()
|
||||
widget->m_updateRegion.createIntersection(widget->m_updateRegion, region);
|
||||
}
|
||||
|
||||
size_t c, nrects = widget->m_updateRegion.size();
|
||||
std::size_t c, nrects = widget->m_updateRegion.size();
|
||||
Region::const_iterator it = widget->m_updateRegion.begin();
|
||||
|
||||
// Draw the widget
|
||||
|
@ -88,7 +88,7 @@ namespace ui {
|
||||
const std::string& getText() const { return m_text; }
|
||||
int getTextInt() const;
|
||||
double getTextDouble() const;
|
||||
size_t getTextLength() const { return m_text.size(); }
|
||||
std::size_t getTextLength() const { return m_text.size(); }
|
||||
void setText(const std::string& text);
|
||||
void setTextf(const char* text, ...);
|
||||
void setTextQuiet(const std::string& text);
|
||||
|
Loading…
x
Reference in New Issue
Block a user